kkt_shoppe 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +55 -0
- data/Rakefile +36 -0
- data/app/assets/images/kkt_shoppe/chosen-sprite.png +0 -0
- data/app/assets/images/kkt_shoppe/chosen-sprite@2x.png +0 -0
- data/app/assets/images/kkt_shoppe/document.svg +1 -0
- data/app/assets/images/kkt_shoppe/icons/bag.svg +1 -0
- data/app/assets/images/kkt_shoppe/icons/balance.svg +1 -0
- data/app/assets/images/kkt_shoppe/icons/box.svg +1 -0
- data/app/assets/images/kkt_shoppe/icons/building.svg +1 -0
- data/app/assets/images/kkt_shoppe/icons/chart.svg +1 -0
- data/app/assets/images/kkt_shoppe/icons/chat.svg +1 -0
- data/app/assets/images/kkt_shoppe/icons/checkbox.svg +1 -0
- data/app/assets/images/kkt_shoppe/icons/checkbox2.svg +1 -0
- data/app/assets/images/kkt_shoppe/icons/cloud.svg +1 -0
- data/app/assets/images/kkt_shoppe/icons/cone.svg +1 -0
- data/app/assets/images/kkt_shoppe/icons/credit_card.svg +1 -0
- data/app/assets/images/kkt_shoppe/icons/currency.svg +1 -0
- data/app/assets/images/kkt_shoppe/icons/edit.svg +14 -0
- data/app/assets/images/kkt_shoppe/icons/flowchart.svg +1 -0
- data/app/assets/images/kkt_shoppe/icons/gift.svg +1 -0
- data/app/assets/images/kkt_shoppe/icons/globe.svg +1 -0
- data/app/assets/images/kkt_shoppe/icons/id.svg +1 -0
- data/app/assets/images/kkt_shoppe/icons/id2.svg +1 -0
- data/app/assets/images/kkt_shoppe/icons/locked.svg +1 -0
- data/app/assets/images/kkt_shoppe/icons/report.svg +1 -0
- data/app/assets/images/kkt_shoppe/icons/search.svg +1 -0
- data/app/assets/images/kkt_shoppe/icons/support.svg +1 -0
- data/app/assets/images/kkt_shoppe/icons/tags.svg +1 -0
- data/app/assets/images/kkt_shoppe/icons/toolbox.svg +1 -0
- data/app/assets/images/kkt_shoppe/icons/unlocked.svg +1 -0
- data/app/assets/images/kkt_shoppe/icons/wallet.svg +1 -0
- data/app/assets/images/kkt_shoppe/kkt_shoppe.svg +25 -0
- data/app/assets/images/kkt_shoppe/logo.svg +47 -0
- data/app/assets/images/kkt_shoppe/move.svg +1 -0
- data/app/assets/images/kkt_shoppe/square.svg +9 -0
- data/app/assets/images/kkt_shoppe/statuses/accepted.svg +14 -0
- data/app/assets/images/kkt_shoppe/statuses/paid.svg +16 -0
- data/app/assets/images/kkt_shoppe/statuses/received.svg +15 -0
- data/app/assets/images/kkt_shoppe/statuses/rejected.svg +14 -0
- data/app/assets/images/kkt_shoppe/statuses/shipped.svg +14 -0
- data/app/assets/images/kkt_shoppe/table-tear-off.png +0 -0
- data/app/assets/javascripts/kkt_shoppe/application.coffee +123 -0
- data/app/assets/javascripts/kkt_shoppe/chosen.jquery.js +1166 -0
- data/app/assets/javascripts/kkt_shoppe/jquery_ui.js +6 -0
- data/app/assets/javascripts/kkt_shoppe/mousetrap.js +9 -0
- data/app/assets/javascripts/kkt_shoppe/order_form.coffee +47 -0
- data/app/assets/stylesheets/kkt_shoppe/application.scss +601 -0
- data/app/assets/stylesheets/kkt_shoppe/chosen.scss +424 -0
- data/app/assets/stylesheets/kkt_shoppe/dialog.scss +25 -0
- data/app/assets/stylesheets/kkt_shoppe/elements.scss +79 -0
- data/app/assets/stylesheets/kkt_shoppe/printable.scss +67 -0
- data/app/assets/stylesheets/kkt_shoppe/reset.scss +93 -0
- data/app/assets/stylesheets/kkt_shoppe/sub.scss +106 -0
- data/app/assets/stylesheets/kkt_shoppe/variables.scss +1 -0
- data/app/controllers/kkt_shoppe/addresses_controller.rb +47 -0
- data/app/controllers/kkt_shoppe/application_controller.rb +46 -0
- data/app/controllers/kkt_shoppe/attachments_controller.rb +14 -0
- data/app/controllers/kkt_shoppe/countries_controller.rb +47 -0
- data/app/controllers/kkt_shoppe/customers_controller.rb +55 -0
- data/app/controllers/kkt_shoppe/dashboard_controller.rb +9 -0
- data/app/controllers/kkt_shoppe/delivery_service_prices_controller.rb +45 -0
- data/app/controllers/kkt_shoppe/delivery_services_controller.rb +47 -0
- data/app/controllers/kkt_shoppe/orders_controller.rb +119 -0
- data/app/controllers/kkt_shoppe/payments_controller.rb +33 -0
- data/app/controllers/kkt_shoppe/product_categories_controller.rb +47 -0
- data/app/controllers/kkt_shoppe/product_category_localisations_controller.rb +58 -0
- data/app/controllers/kkt_shoppe/product_localisations_controller.rb +58 -0
- data/app/controllers/kkt_shoppe/products_controller.rb +58 -0
- data/app/controllers/kkt_shoppe/sessions_controller.rb +34 -0
- data/app/controllers/kkt_shoppe/settings_controller.rb +16 -0
- data/app/controllers/kkt_shoppe/stock_level_adjustments_controller.rb +40 -0
- data/app/controllers/kkt_shoppe/tax_rates_controller.rb +49 -0
- data/app/controllers/kkt_shoppe/users_controller.rb +53 -0
- data/app/controllers/kkt_shoppe/variants_controller.rb +50 -0
- data/app/helpers/kkt_shoppe/application_helper.rb +60 -0
- data/app/helpers/kkt_shoppe/product_category_helper.rb +36 -0
- data/app/mailers/kkt_shoppe/order_mailer.rb +25 -0
- data/app/mailers/kkt_shoppe/user_mailer.rb +10 -0
- data/app/models/kkt_shoppe/address.rb +44 -0
- data/app/models/kkt_shoppe/country.rb +27 -0
- data/app/models/kkt_shoppe/customer.rb +41 -0
- data/app/models/kkt_shoppe/delivery_service.rb +33 -0
- data/app/models/kkt_shoppe/delivery_service_price.rb +31 -0
- data/app/models/kkt_shoppe/order/actions.rb +94 -0
- data/app/models/kkt_shoppe/order/billing.rb +105 -0
- data/app/models/kkt_shoppe/order/delivery.rb +229 -0
- data/app/models/kkt_shoppe/order/states.rb +69 -0
- data/app/models/kkt_shoppe/order.rb +100 -0
- data/app/models/kkt_shoppe/order_item.rb +239 -0
- data/app/models/kkt_shoppe/payment.rb +86 -0
- data/app/models/kkt_shoppe/product/product_attributes.rb +20 -0
- data/app/models/kkt_shoppe/product/variants.rb +51 -0
- data/app/models/kkt_shoppe/product.rb +189 -0
- data/app/models/kkt_shoppe/product_attribute.rb +66 -0
- data/app/models/kkt_shoppe/product_categorization.rb +14 -0
- data/app/models/kkt_shoppe/product_category.rb +75 -0
- data/app/models/kkt_shoppe/setting.rb +68 -0
- data/app/models/kkt_shoppe/stock_level_adjustment.rb +19 -0
- data/app/models/kkt_shoppe/tax_rate.rb +46 -0
- data/app/models/kkt_shoppe/user.rb +49 -0
- data/app/validators/permalink_validator.rb +7 -0
- data/app/views/kkt_shoppe/addresses/_form.html.haml +33 -0
- data/app/views/kkt_shoppe/addresses/edit.html.haml +5 -0
- data/app/views/kkt_shoppe/addresses/new.html.haml +5 -0
- data/app/views/kkt_shoppe/countries/_form.html.haml +35 -0
- data/app/views/kkt_shoppe/countries/edit.html.haml +6 -0
- data/app/views/kkt_shoppe/countries/index.html.haml +25 -0
- data/app/views/kkt_shoppe/countries/new.html.haml +7 -0
- data/app/views/kkt_shoppe/customers/_addresses.html.haml +20 -0
- data/app/views/kkt_shoppe/customers/_form.html.haml +30 -0
- data/app/views/kkt_shoppe/customers/_search_form.html.haml +13 -0
- data/app/views/kkt_shoppe/customers/edit.html.haml +5 -0
- data/app/views/kkt_shoppe/customers/index.html.haml +32 -0
- data/app/views/kkt_shoppe/customers/new.html.haml +5 -0
- data/app/views/kkt_shoppe/customers/show.html.haml +53 -0
- data/app/views/kkt_shoppe/delivery_service_prices/_form.html.haml +44 -0
- data/app/views/kkt_shoppe/delivery_service_prices/edit.html.haml +6 -0
- data/app/views/kkt_shoppe/delivery_service_prices/index.html.haml +23 -0
- data/app/views/kkt_shoppe/delivery_service_prices/new.html.haml +6 -0
- data/app/views/kkt_shoppe/delivery_services/_form.html.haml +38 -0
- data/app/views/kkt_shoppe/delivery_services/edit.html.haml +9 -0
- data/app/views/kkt_shoppe/delivery_services/index.html.haml +27 -0
- data/app/views/kkt_shoppe/delivery_services/new.html.haml +6 -0
- data/app/views/kkt_shoppe/order_mailer/accepted.text.erb +12 -0
- data/app/views/kkt_shoppe/order_mailer/received.text.erb +9 -0
- data/app/views/kkt_shoppe/order_mailer/rejected.text.erb +10 -0
- data/app/views/kkt_shoppe/order_mailer/shipped.text.erb +16 -0
- data/app/views/kkt_shoppe/orders/_form.html.haml +58 -0
- data/app/views/kkt_shoppe/orders/_order_details.html.haml +57 -0
- data/app/views/kkt_shoppe/orders/_order_items.html.haml +38 -0
- data/app/views/kkt_shoppe/orders/_order_items_form.html.haml +61 -0
- data/app/views/kkt_shoppe/orders/_payments_form.html.haml +15 -0
- data/app/views/kkt_shoppe/orders/_payments_table.html.haml +37 -0
- data/app/views/kkt_shoppe/orders/_search_form.html.haml +24 -0
- data/app/views/kkt_shoppe/orders/_status_bar.html.haml +35 -0
- data/app/views/kkt_shoppe/orders/despatch_note.html.haml +45 -0
- data/app/views/kkt_shoppe/orders/edit.html.haml +21 -0
- data/app/views/kkt_shoppe/orders/index.html.haml +39 -0
- data/app/views/kkt_shoppe/orders/new.html.haml +14 -0
- data/app/views/kkt_shoppe/orders/show.html.haml +25 -0
- data/app/views/kkt_shoppe/payments/refund.html.haml +13 -0
- data/app/views/kkt_shoppe/product_categories/_form.html.haml +50 -0
- data/app/views/kkt_shoppe/product_categories/edit.html.haml +8 -0
- data/app/views/kkt_shoppe/product_categories/index.html.haml +27 -0
- data/app/views/kkt_shoppe/product_categories/new.html.haml +6 -0
- data/app/views/kkt_shoppe/product_category_localisations/form.html.haml +29 -0
- data/app/views/kkt_shoppe/product_category_localisations/index.html.haml +26 -0
- data/app/views/kkt_shoppe/product_localisations/form.html.haml +32 -0
- data/app/views/kkt_shoppe/product_localisations/index.html.haml +26 -0
- data/app/views/kkt_shoppe/products/_form.html.haml +118 -0
- data/app/views/kkt_shoppe/products/_table.html.haml +42 -0
- data/app/views/kkt_shoppe/products/edit.html.haml +9 -0
- data/app/views/kkt_shoppe/products/import.html.haml +67 -0
- data/app/views/kkt_shoppe/products/index.html.haml +9 -0
- data/app/views/kkt_shoppe/products/new.html.haml +7 -0
- data/app/views/kkt_shoppe/sessions/new.html.haml +12 -0
- data/app/views/kkt_shoppe/sessions/reset.html.haml +12 -0
- data/app/views/kkt_shoppe/settings/edit.html.haml +19 -0
- data/app/views/kkt_shoppe/shared/error.html.haml +6 -0
- data/app/views/kkt_shoppe/stock_level_adjustments/index.html.haml +40 -0
- data/app/views/kkt_shoppe/tax_rates/form.html.haml +28 -0
- data/app/views/kkt_shoppe/tax_rates/index.html.haml +17 -0
- data/app/views/kkt_shoppe/user_mailer/new_password.text.erb +9 -0
- data/app/views/kkt_shoppe/users/_form.html.haml +27 -0
- data/app/views/kkt_shoppe/users/edit.html.haml +5 -0
- data/app/views/kkt_shoppe/users/index.html.haml +17 -0
- data/app/views/kkt_shoppe/users/new.html.haml +7 -0
- data/app/views/kkt_shoppe/variants/form.html.haml +68 -0
- data/app/views/kkt_shoppe/variants/index.html.haml +33 -0
- data/app/views/layouts/kkt_shoppe/application.html.haml +34 -0
- data/app/views/layouts/kkt_shoppe/printable.html.haml +11 -0
- data/app/views/layouts/kkt_shoppe/sub.html.haml +10 -0
- data/config/locales/de.yml +653 -0
- data/config/locales/en.yml +744 -0
- data/config/locales/es.yml +653 -0
- data/config/locales/pl.yml +662 -0
- data/config/locales/pt-BR.yml +655 -0
- data/config/routes.rb +53 -0
- data/db/countries.txt +252 -0
- data/db/migrate/20130926094549_create_kkt_shoppe_initial_schema.rb +175 -0
- data/db/migrate/20131024201501_add_address_type_to_kkt_shoppe_tax_rates.rb +5 -0
- data/db/migrate/20131024204815_create_kkt_shoppe_payments.rb +32 -0
- data/db/migrate/20131102143930_remove_default_on_order_item_weight.rb +9 -0
- data/db/migrate/20141013192427_create_kkt_shoppe_customers.rb +14 -0
- data/db/migrate/20141026175622_add_indexes_to_kkt_shoppe_order_items.rb +6 -0
- data/db/migrate/20141026175943_add_indexes_to_kkt_shoppe_orders.rb +7 -0
- data/db/migrate/20141026180333_add_indexes_to_kkt_shoppe_payments.rb +6 -0
- data/db/migrate/20141026180835_add_indexes_to_kkt_shoppe_product_attributes.rb +7 -0
- data/db/migrate/20141026180952_add_indexes_to_kkt_shoppe_product_categories.rb +5 -0
- data/db/migrate/20141026181040_add_indexes_to_kkt_shoppe_products.rb +8 -0
- data/db/migrate/20141026181312_add_indexes_to_kkt_shoppe_settings.rb +5 -0
- data/db/migrate/20141026181354_add_indexes_to_kkt_shoppe_stock_level_adjustments.rb +6 -0
- data/db/migrate/20141026181559_add_indexes_to_kkt_shoppe_users.rb +5 -0
- data/db/migrate/20141026181716_add_indexes_to_kkt_shoppe_delivery_services.rb +9 -0
- data/db/migrate/20141026181717_allow_multiple_kkt_shoppe_products_per_shoppe_product_category.rb +46 -0
- data/db/migrate/20141026181718_add_nested_to_product_categories.rb +30 -0
- data/db/migrate/20141027215005_create_kkt_shoppe_addresses.rb +17 -0
- data/db/migrate/20150315215633_add_customer_to_kkt_shoppe_orders.rb +5 -0
- data/db/migrate/20150513171350_create_kkt_shoppe_product_category_translation_table.rb +17 -0
- data/db/migrate/20150519173350_create_kkt_shoppe_product_translation_table.rb +18 -0
- data/db/schema.rb +308 -0
- data/db/seeds.rb +137 -0
- data/db/seeds_data/poe400.jpg +0 -0
- data/db/seeds_data/snom-870-blk.jpg +0 -0
- data/db/seeds_data/snom-870-grey.jpg +0 -0
- data/db/seeds_data/snom-mm2.jpg +0 -0
- data/db/seeds_data/spa303.jpg +0 -0
- data/db/seeds_data/t18p.jpg +0 -0
- data/db/seeds_data/t20p.jpg +0 -0
- data/db/seeds_data/t22p.jpg +0 -0
- data/db/seeds_data/t26p.jpg +0 -0
- data/db/seeds_data/t41pn.jpg +0 -0
- data/db/seeds_data/t46gn.jpg +0 -0
- data/db/seeds_data/w52p.jpg +0 -0
- data/db/seeds_data/yhs32.jpg +0 -0
- data/lib/kkt_shoppe/associated_countries.rb +20 -0
- data/lib/kkt_shoppe/country_importer.rb +15 -0
- data/lib/kkt_shoppe/default_navigation.rb +21 -0
- data/lib/kkt_shoppe/engine.rb +55 -0
- data/lib/kkt_shoppe/error.rb +21 -0
- data/lib/kkt_shoppe/errors/inappropriate_delivery_service.rb +6 -0
- data/lib/kkt_shoppe/errors/insufficient_stock_to_fulfil.rb +15 -0
- data/lib/kkt_shoppe/errors/invalid_configuration.rb +6 -0
- data/lib/kkt_shoppe/errors/not_enough_stock.rb +15 -0
- data/lib/kkt_shoppe/errors/payment_declined.rb +6 -0
- data/lib/kkt_shoppe/errors/refund_failed.rb +6 -0
- data/lib/kkt_shoppe/errors/unorderable_item.rb +6 -0
- data/lib/kkt_shoppe/navigation_manager.rb +81 -0
- data/lib/kkt_shoppe/orderable_item.rb +39 -0
- data/lib/kkt_shoppe/settings.rb +26 -0
- data/lib/kkt_shoppe/settings_loader.rb +16 -0
- data/lib/kkt_shoppe/setup_generator.rb +10 -0
- data/lib/kkt_shoppe/version.rb +3 -0
- data/lib/kkt_shoppe/view_helpers.rb +16 -0
- data/lib/kkt_shoppe.rb +60 -0
- data/lib/tasks/kylekthompson_shoppe.rake +29 -0
- metadata +662 -0
data/db/countries.txt
ADDED
@@ -0,0 +1,252 @@
|
|
1
|
+
AD AND Andorra EU .ad EUR
|
2
|
+
AE ARE United Arab Emirates AS .ae AED
|
3
|
+
AF AFG Afghanistan AS .af AFN
|
4
|
+
AG ATG Antigua and Barbuda NA .ag XCD
|
5
|
+
AI AIA Anguilla NA .ai XCD
|
6
|
+
AL ALB Albania EU .al ALL
|
7
|
+
AM ARM Armenia AS .am AMD
|
8
|
+
AO AGO Angola AF .ao AOA
|
9
|
+
AQ ATA Antarctica AN .aq
|
10
|
+
AR ARG Argentina SA .ar ARS
|
11
|
+
AS ASM American Samoa OC .as USD
|
12
|
+
AT AUT Austria EU .at EUR
|
13
|
+
AU AUS Australia OC .au AUD
|
14
|
+
AW ABW Aruba NA .aw AWG
|
15
|
+
AX ALA Aland Islands EU .ax EUR
|
16
|
+
AZ AZE Azerbaijan AS .az AZN
|
17
|
+
BA BIH Bosnia and Herzegovina EU .ba BAM
|
18
|
+
BB BRB Barbados NA .bb BBD
|
19
|
+
BD BGD Bangladesh AS .bd BDT
|
20
|
+
BE BEL Belgium EU .be EUR
|
21
|
+
BF BFA Burkina Faso AF .bf XOF
|
22
|
+
BG BGR Bulgaria EU .bg BGN
|
23
|
+
BH BHR Bahrain AS .bh BHD
|
24
|
+
BI BDI Burundi AF .bi BIF
|
25
|
+
BJ BEN Benin AF .bj XOF
|
26
|
+
BL BLM Saint Barthelemy NA .gp EUR
|
27
|
+
BM BMU Bermuda NA .bm BMD
|
28
|
+
BN BRN Brunei AS .bn BND
|
29
|
+
BO BOL Bolivia SA .bo BOB
|
30
|
+
BQ BES Bonaire, Saint Eustatius and Saba NA .bq USD
|
31
|
+
BR BRA Brazil SA .br BRL
|
32
|
+
BS BHS Bahamas NA .bs BSD
|
33
|
+
BT BTN Bhutan AS .bt BTN
|
34
|
+
BV BVT Bouvet Island AN .bv NOK
|
35
|
+
BW BWA Botswana AF .bw BWP
|
36
|
+
BY BLR Belarus EU .by BYR
|
37
|
+
BZ BLZ Belize NA .bz BZD
|
38
|
+
CA CAN Canada NA .ca CAD
|
39
|
+
CC CCK Cocos Islands AS .cc AUD
|
40
|
+
CD COD Democratic Republic of the Congo AF .cd CDF
|
41
|
+
CF CAF Central African Republic AF .cf XAF
|
42
|
+
CG COG Republic of the Congo AF .cg XAF
|
43
|
+
CH CHE Switzerland EU .ch CHF
|
44
|
+
CI CIV Ivory Coast AF .ci XOF
|
45
|
+
CK COK Cook Islands OC .ck NZD
|
46
|
+
CL CHL Chile SA .cl CLP
|
47
|
+
CM CMR Cameroon AF .cm XAF
|
48
|
+
CN CHN China AS .cn CNY
|
49
|
+
CO COL Colombia SA .co COP
|
50
|
+
CR CRI Costa Rica NA .cr CRC
|
51
|
+
CU CUB Cuba NA .cu CUP
|
52
|
+
CV CPV Cape Verde AF .cv CVE
|
53
|
+
CW CUW Curacao NA .cw ANG
|
54
|
+
CX CXR Christmas Island AS .cx AUD
|
55
|
+
CY CYP Cyprus EU .cy EUR
|
56
|
+
CZ CZE Czech Republic EU .cz CZK
|
57
|
+
DE DEU Germany EU .de EUR
|
58
|
+
DJ DJI Djibouti AF .dj DJF
|
59
|
+
DK DNK Denmark EU .dk DKK
|
60
|
+
DM DMA Dominica NA .dm XCD
|
61
|
+
DO DOM Dominican Republic NA .do DOP
|
62
|
+
DZ DZA Algeria AF .dz DZD
|
63
|
+
EC ECU Ecuador SA .ec USD
|
64
|
+
EE EST Estonia EU .ee EUR
|
65
|
+
EG EGY Egypt AF .eg EGP
|
66
|
+
EH ESH Western Sahara AF .eh MAD
|
67
|
+
ER ERI Eritrea AF .er ERN
|
68
|
+
ES ESP Spain EU .es EUR
|
69
|
+
ET ETH Ethiopia AF .et ETB
|
70
|
+
FI FIN Finland EU .fi EUR
|
71
|
+
FJ FJI Fiji OC .fj FJD
|
72
|
+
FK FLK Falkland Islands SA .fk FKP
|
73
|
+
FM FSM Micronesia OC .fm USD
|
74
|
+
FO FRO Faroe Islands EU .fo DKK
|
75
|
+
FR FRA France EU .fr EUR
|
76
|
+
GA GAB Gabon AF .ga XAF
|
77
|
+
GB GBR United Kingdom EU .uk GBP
|
78
|
+
GD GRD Grenada NA .gd XCD
|
79
|
+
GE GEO Georgia AS .ge GEL
|
80
|
+
GF GUF French Guiana SA .gf EUR
|
81
|
+
GG GGY Guernsey EU .gg GBP
|
82
|
+
GH GHA Ghana AF .gh GHS
|
83
|
+
GI GIB Gibraltar EU .gi GIP
|
84
|
+
GL GRL Greenland NA .gl DKK
|
85
|
+
GM GMB Gambia AF .gm GMD
|
86
|
+
GN GIN Guinea AF .gn GNF
|
87
|
+
GP GLP Guadeloupe NA .gp EUR
|
88
|
+
GQ GNQ Equatorial Guinea AF .gq XAF
|
89
|
+
GR GRC Greece EU .gr EUR
|
90
|
+
GS SGS South Georgia and the South Sandwich Islands AN .gs GBP
|
91
|
+
GT GTM Guatemala NA .gt GTQ
|
92
|
+
GU GUM Guam OC .gu USD
|
93
|
+
GW GNB Guinea-Bissau AF .gw XOF
|
94
|
+
GY GUY Guyana SA .gy GYD
|
95
|
+
HK HKG Hong Kong AS .hk HKD
|
96
|
+
HM HMD Heard Island and McDonald Islands AN .hm AUD
|
97
|
+
HN HND Honduras NA .hn HNL
|
98
|
+
HR HRV Croatia EU .hr HRK
|
99
|
+
HT HTI Haiti NA .ht HTG
|
100
|
+
HU HUN Hungary EU .hu HUF
|
101
|
+
ID IDN Indonesia AS .id IDR
|
102
|
+
IE IRL Ireland EU .ie EUR
|
103
|
+
IL ISR Israel AS .il ILS
|
104
|
+
IM IMN Isle of Man EU .im GBP
|
105
|
+
IN IND India AS .in INR
|
106
|
+
IO IOT British Indian Ocean Territory AS .io USD
|
107
|
+
IQ IRQ Iraq AS .iq IQD
|
108
|
+
IR IRN Iran AS .ir IRR
|
109
|
+
IS ISL Iceland EU .is ISK
|
110
|
+
IT ITA Italy EU .it EUR
|
111
|
+
JE JEY Jersey EU .je GBP
|
112
|
+
JM JAM Jamaica NA .jm JMD
|
113
|
+
JO JOR Jordan AS .jo JOD
|
114
|
+
JP JPN Japan AS .jp JPY
|
115
|
+
KE KEN Kenya AF .ke KES
|
116
|
+
KG KGZ Kyrgyzstan AS .kg KGS
|
117
|
+
KH KHM Cambodia AS .kh KHR
|
118
|
+
KI KIR Kiribati OC .ki AUD
|
119
|
+
KM COM Comoros AF .km KMF
|
120
|
+
KN KNA Saint Kitts and Nevis NA .kn XCD
|
121
|
+
KP PRK North Korea AS .kp KPW
|
122
|
+
KR KOR South Korea AS .kr KRW
|
123
|
+
XK XKX Kosovo EU EUR
|
124
|
+
KW KWT Kuwait AS .kw KWD
|
125
|
+
KY CYM Cayman Islands NA .ky KYD
|
126
|
+
KZ KAZ Kazakhstan AS .kz KZT
|
127
|
+
LA LAO Laos AS .la LAK
|
128
|
+
LB LBN Lebanon AS .lb LBP
|
129
|
+
LC LCA Saint Lucia NA .lc XCD
|
130
|
+
LI LIE Liechtenstein EU .li CHF
|
131
|
+
LK LKA Sri Lanka AS .lk LKR
|
132
|
+
LR LBR Liberia AF .lr LRD
|
133
|
+
LS LSO Lesotho AF .ls LSL
|
134
|
+
LT LTU Lithuania EU .lt LTL
|
135
|
+
LU LUX Luxembourg EU .lu EUR
|
136
|
+
LV LVA Latvia EU .lv LVL
|
137
|
+
LY LBY Libya AF .ly LYD
|
138
|
+
MA MAR Morocco AF .ma MAD
|
139
|
+
MC MCO Monaco EU .mc EUR
|
140
|
+
MD MDA Moldova EU .md MDL
|
141
|
+
ME MNE Montenegro EU .me EUR
|
142
|
+
MF MAF Saint Martin NA .gp EUR
|
143
|
+
MG MDG Madagascar AF .mg MGA
|
144
|
+
MH MHL Marshall Islands OC .mh USD
|
145
|
+
MK MKD Macedonia EU .mk MKD
|
146
|
+
ML MLI Mali AF .ml XOF
|
147
|
+
MM MMR Myanmar AS .mm MMK
|
148
|
+
MN MNG Mongolia AS .mn MNT
|
149
|
+
MO MAC Macao AS .mo MOP
|
150
|
+
MP MNP Northern Mariana Islands OC .mp USD
|
151
|
+
MQ MTQ Martinique NA .mq EUR
|
152
|
+
MR MRT Mauritania AF .mr MRO
|
153
|
+
MS MSR Montserrat NA .ms XCD
|
154
|
+
MT MLT Malta EU .mt EUR
|
155
|
+
MU MUS Mauritius AF .mu MUR
|
156
|
+
MV MDV Maldives AS .mv MVR
|
157
|
+
MW MWI Malawi AF .mw MWK
|
158
|
+
MX MEX Mexico NA .mx MXN
|
159
|
+
MY MYS Malaysia AS .my MYR
|
160
|
+
MZ MOZ Mozambique AF .mz MZN
|
161
|
+
NA NAM Namibia AF .na NAD
|
162
|
+
NC NCL New Caledonia OC .nc XPF
|
163
|
+
NE NER Niger AF .ne XOF
|
164
|
+
NF NFK Norfolk Island OC .nf AUD
|
165
|
+
NG NGA Nigeria AF .ng NGN
|
166
|
+
NI NIC Nicaragua NA .ni NIO
|
167
|
+
NL NLD Netherlands EU .nl EUR
|
168
|
+
NO NOR Norway EU .no NOK
|
169
|
+
NP NPL Nepal AS .np NPR
|
170
|
+
NR NRU Nauru OC .nr AUD
|
171
|
+
NU NIU Niue OC .nu NZD
|
172
|
+
NZ NZL New Zealand OC .nz NZD
|
173
|
+
OM OMN Oman AS .om OMR
|
174
|
+
PA PAN Panama NA .pa PAB
|
175
|
+
PE PER Peru SA .pe PEN
|
176
|
+
PF PYF French Polynesia OC .pf XPF
|
177
|
+
PG PNG Papua New Guinea OC .pg PGK
|
178
|
+
PH PHL Philippines AS .ph PHP
|
179
|
+
PK PAK Pakistan AS .pk PKR
|
180
|
+
PL POL Poland EU .pl PLN
|
181
|
+
PM SPM Saint Pierre and Miquelon NA .pm EUR
|
182
|
+
PN PCN Pitcairn OC .pn NZD
|
183
|
+
PR PRI Puerto Rico NA .pr USD
|
184
|
+
PS PSE Palestinian Territory AS .ps ILS
|
185
|
+
PT PRT Portugal EU .pt EUR
|
186
|
+
PW PLW Palau OC .pw USD
|
187
|
+
PY PRY Paraguay SA .py PYG
|
188
|
+
QA QAT Qatar AS .qa QAR
|
189
|
+
RE REU Reunion AF .re EUR
|
190
|
+
RO ROU Romania EU .ro RON
|
191
|
+
RS SRB Serbia EU .rs RSD
|
192
|
+
RU RUS Russia EU .ru RUB
|
193
|
+
RW RWA Rwanda AF .rw RWF
|
194
|
+
SA SAU Saudi Arabia AS .sa SAR
|
195
|
+
SB SLB Solomon Islands OC .sb SBD
|
196
|
+
SC SYC Seychelles AF .sc SCR
|
197
|
+
SD SDN Sudan AF .sd SDG
|
198
|
+
SS SSD South Sudan AF SSP
|
199
|
+
SE SWE Sweden EU .se SEK
|
200
|
+
SG SGP Singapore AS .sg SGD
|
201
|
+
SH SHN Saint Helena AF .sh SHP
|
202
|
+
SI SVN Slovenia EU .si EUR
|
203
|
+
SJ SJM Svalbard and Jan Mayen EU .sj NOK
|
204
|
+
SK SVK Slovakia EU .sk EUR
|
205
|
+
SL SLE Sierra Leone AF .sl SLL
|
206
|
+
SM SMR San Marino EU .sm EUR
|
207
|
+
SN SEN Senegal AF .sn XOF
|
208
|
+
SO SOM Somalia AF .so SOS
|
209
|
+
SR SUR Suriname SA .sr SRD
|
210
|
+
ST STP Sao Tome and Principe AF .st STD
|
211
|
+
SV SLV El Salvador NA .sv USD
|
212
|
+
SX SXM Sint Maarten NA .sx ANG
|
213
|
+
SY SYR Syria AS .sy SYP
|
214
|
+
SZ SWZ Swaziland AF .sz SZL
|
215
|
+
TC TCA Turks and Caicos Islands NA .tc USD
|
216
|
+
TD TCD Chad AF .td XAF
|
217
|
+
TF ATF French Southern Territories AN .tf EUR
|
218
|
+
TG TGO Togo AF .tg XOF
|
219
|
+
TH THA Thailand AS .th THB
|
220
|
+
TJ TJK Tajikistan AS .tj TJS
|
221
|
+
TK TKL Tokelau OC .tk NZD
|
222
|
+
TL TLS East Timor OC .tl USD
|
223
|
+
TM TKM Turkmenistan AS .tm TMT
|
224
|
+
TN TUN Tunisia AF .tn TND
|
225
|
+
TO TON Tonga OC .to TOP
|
226
|
+
TR TUR Turkey AS .tr TRY
|
227
|
+
TT TTO Trinidad and Tobago NA .tt TTD
|
228
|
+
TV TUV Tuvalu OC .tv AUD
|
229
|
+
TW TWN Taiwan AS .tw TWD
|
230
|
+
TZ TZA Tanzania AF .tz TZS
|
231
|
+
UA UKR Ukraine EU .ua UAH
|
232
|
+
UG UGA Uganda AF .ug UGX
|
233
|
+
UM UMI United States Minor Outlying Islands OC .um USD
|
234
|
+
US USA United States NA .us USD
|
235
|
+
UY URY Uruguay SA .uy UYU
|
236
|
+
UZ UZB Uzbekistan AS .uz UZS
|
237
|
+
VA VAT Vatican EU .va EUR
|
238
|
+
VC VCT Saint Vincent and the Grenadines NA .vc XCD
|
239
|
+
VE VEN Venezuela SA .ve VEF
|
240
|
+
VG VGB British Virgin Islands NA .vg USD
|
241
|
+
VI VIR U.S. Virgin Islands NA .vi USD
|
242
|
+
VN VNM Vietnam AS .vn VND
|
243
|
+
VU VUT Vanuatu OC .vu VUV
|
244
|
+
WF WLF Wallis and Futuna OC .wf XPF
|
245
|
+
WS WSM Samoa OC .ws WST
|
246
|
+
YE YEM Yemen AS .ye YER
|
247
|
+
YT MYT Mayotte AF .yt EUR
|
248
|
+
ZA ZAF South Africa AF .za ZAR
|
249
|
+
ZM ZMB Zambia AF .zm ZMK
|
250
|
+
ZW ZWE Zimbabwe AF .zw ZWL
|
251
|
+
CS SCG Serbia and Montenegro EU .cs RSD
|
252
|
+
AN ANT Netherlands Antilles NA .an ANG
|
@@ -0,0 +1,175 @@
|
|
1
|
+
class CreateKktShoppeInitialSchema < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
create_table "kkt_shoppe_countries" do |t|
|
4
|
+
t.string "name"
|
5
|
+
t.string "code2"
|
6
|
+
t.string "code3"
|
7
|
+
t.string "continent"
|
8
|
+
t.string "tld"
|
9
|
+
t.string "currency"
|
10
|
+
t.boolean "eu_member", default: false
|
11
|
+
end
|
12
|
+
|
13
|
+
create_table "kkt_shoppe_delivery_service_prices" do |t|
|
14
|
+
t.integer "delivery_service_id"
|
15
|
+
t.string "code"
|
16
|
+
t.decimal "price", precision: 8, scale: 2
|
17
|
+
t.decimal "cost_price", precision: 8, scale: 2
|
18
|
+
t.integer "tax_rate_id"
|
19
|
+
t.decimal "min_weight", precision: 8, scale: 2
|
20
|
+
t.decimal "max_weight", precision: 8, scale: 2
|
21
|
+
t.datetime "created_at"
|
22
|
+
t.datetime "updated_at"
|
23
|
+
t.text "country_ids"
|
24
|
+
end
|
25
|
+
|
26
|
+
create_table "kkt_shoppe_delivery_services" do |t|
|
27
|
+
t.string "name"
|
28
|
+
t.string "code"
|
29
|
+
t.boolean "default", default: false
|
30
|
+
t.boolean "active", default: true
|
31
|
+
t.datetime "created_at"
|
32
|
+
t.datetime "updated_at"
|
33
|
+
t.string "courier"
|
34
|
+
t.string "tracking_url"
|
35
|
+
end
|
36
|
+
|
37
|
+
create_table "kkt_shoppe_order_items" do |t|
|
38
|
+
t.integer "order_id"
|
39
|
+
t.integer "ordered_item_id"
|
40
|
+
t.string "ordered_item_type"
|
41
|
+
t.integer "quantity", default: 1
|
42
|
+
t.decimal "unit_price", precision: 8, scale: 2
|
43
|
+
t.decimal "unit_cost_price", precision: 8, scale: 2
|
44
|
+
t.decimal "tax_amount", precision: 8, scale: 2
|
45
|
+
t.decimal "tax_rate", precision: 8, scale: 2
|
46
|
+
t.decimal "weight", precision: 8, scale: 3, default: 0.0
|
47
|
+
t.datetime "created_at"
|
48
|
+
t.datetime "updated_at"
|
49
|
+
end
|
50
|
+
|
51
|
+
create_table "kkt_shoppe_orders" do |t|
|
52
|
+
t.string "token"
|
53
|
+
t.string "first_name"
|
54
|
+
t.string "last_name"
|
55
|
+
t.string "company"
|
56
|
+
t.string "billing_address1"
|
57
|
+
t.string "billing_address2"
|
58
|
+
t.string "billing_address3"
|
59
|
+
t.string "billing_address4"
|
60
|
+
t.string "billing_postcode"
|
61
|
+
t.integer "billing_country_id"
|
62
|
+
t.string "email_address"
|
63
|
+
t.string "phone_number"
|
64
|
+
t.string "status"
|
65
|
+
t.datetime "received_at"
|
66
|
+
t.datetime "accepted_at"
|
67
|
+
t.datetime "shipped_at"
|
68
|
+
t.datetime "created_at"
|
69
|
+
t.datetime "updated_at"
|
70
|
+
t.integer "delivery_service_id"
|
71
|
+
t.decimal "delivery_price", precision: 8, scale: 2
|
72
|
+
t.decimal "delivery_cost_price", precision: 8, scale: 2
|
73
|
+
t.decimal "delivery_tax_rate", precision: 8, scale: 2
|
74
|
+
t.decimal "delivery_tax_amount", precision: 8, scale: 2
|
75
|
+
t.datetime "paid_at"
|
76
|
+
t.integer "accepted_by"
|
77
|
+
t.integer "shipped_by"
|
78
|
+
t.string "consignment_number"
|
79
|
+
t.datetime "rejected_at"
|
80
|
+
t.integer "rejected_by"
|
81
|
+
t.string "ip_address"
|
82
|
+
t.string "payment_reference"
|
83
|
+
t.string "payment_method"
|
84
|
+
t.text "notes"
|
85
|
+
t.boolean "separate_delivery_address", default: false
|
86
|
+
t.string "delivery_name"
|
87
|
+
t.string "delivery_address1"
|
88
|
+
t.string "delivery_address2"
|
89
|
+
t.string "delivery_address3"
|
90
|
+
t.string "delivery_address4"
|
91
|
+
t.string "delivery_postcode"
|
92
|
+
t.integer "delivery_country_id"
|
93
|
+
end
|
94
|
+
|
95
|
+
create_table "kkt_shoppe_product_attributes" do |t|
|
96
|
+
t.integer "product_id"
|
97
|
+
t.string "key"
|
98
|
+
t.string "value"
|
99
|
+
t.integer "position", default: 1
|
100
|
+
t.boolean "searchable", default: true
|
101
|
+
t.datetime "created_at"
|
102
|
+
t.datetime "updated_at"
|
103
|
+
t.boolean "public", default: true
|
104
|
+
end
|
105
|
+
|
106
|
+
create_table "kkt_shoppe_product_categories" do |t|
|
107
|
+
t.string "name"
|
108
|
+
t.string "permalink"
|
109
|
+
t.text "description"
|
110
|
+
t.datetime "created_at"
|
111
|
+
t.datetime "updated_at"
|
112
|
+
end
|
113
|
+
|
114
|
+
create_table "kkt_shoppe_products" do |t|
|
115
|
+
t.integer "parent_id"
|
116
|
+
t.integer "product_category_id"
|
117
|
+
t.string "name"
|
118
|
+
t.string "sku"
|
119
|
+
t.string "permalink"
|
120
|
+
t.text "description"
|
121
|
+
t.text "short_description"
|
122
|
+
t.boolean "active", default: true
|
123
|
+
t.decimal "weight", precision: 8, scale: 3, default: 0.0
|
124
|
+
t.decimal "price", precision: 8, scale: 2, default: 0.0
|
125
|
+
t.decimal "cost_price", precision: 8, scale: 2, default: 0.0
|
126
|
+
t.integer "tax_rate_id"
|
127
|
+
t.datetime "created_at"
|
128
|
+
t.datetime "updated_at"
|
129
|
+
t.boolean "featured", default: false
|
130
|
+
t.text "in_the_box"
|
131
|
+
t.boolean "stock_control", default: true
|
132
|
+
t.boolean "default", default: false
|
133
|
+
end
|
134
|
+
|
135
|
+
create_table "kkt_shoppe_settings" do |t|
|
136
|
+
t.string "key"
|
137
|
+
t.string "value"
|
138
|
+
t.string "value_type"
|
139
|
+
end
|
140
|
+
|
141
|
+
create_table "kkt_shoppe_stock_level_adjustments" do |t|
|
142
|
+
t.integer "item_id"
|
143
|
+
t.string "item_type"
|
144
|
+
t.string "description"
|
145
|
+
t.integer "adjustment", default: 0
|
146
|
+
t.string "parent_type"
|
147
|
+
t.integer "parent_id"
|
148
|
+
t.datetime "created_at"
|
149
|
+
t.datetime "updated_at"
|
150
|
+
end
|
151
|
+
|
152
|
+
create_table "kkt_shoppe_tax_rates" do |t|
|
153
|
+
t.string "name"
|
154
|
+
t.decimal "rate", precision: 8, scale: 2
|
155
|
+
t.datetime "created_at"
|
156
|
+
t.datetime "updated_at"
|
157
|
+
t.text "country_ids"
|
158
|
+
end
|
159
|
+
|
160
|
+
create_table "kkt_shoppe_users" do |t|
|
161
|
+
t.string "first_name"
|
162
|
+
t.string "last_name"
|
163
|
+
t.string "email_address"
|
164
|
+
t.string "password_digest"
|
165
|
+
t.datetime "created_at"
|
166
|
+
t.datetime "updated_at"
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
def down
|
171
|
+
[:users, :tax_rates, :stock_level_adjustments, :settings, :products, :product_categories, :product_attributes, :orders, :order_items, :delivery_services, :delivery_service_prices, :countries].each do |table|
|
172
|
+
drop_table "kkt_shoppe_#{table}"
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class CreateKktShoppePayments < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
create_table :kkt_shoppe_payments do |t|
|
4
|
+
t.integer :order_id
|
5
|
+
t.decimal :amount, :precision => 8, :scale => 2, :default => 0.0
|
6
|
+
t.string :reference, :method
|
7
|
+
t.boolean :confirmed, :default => true
|
8
|
+
t.boolean :refundable, :default => false
|
9
|
+
t.decimal :amount_refunded, :precision => 8, :scale => 2, :default => 0.0
|
10
|
+
t.integer :parent_payment_id
|
11
|
+
t.boolean :exported, :default => false
|
12
|
+
t.timestamps
|
13
|
+
end
|
14
|
+
remove_column :kkt_shoppe_orders, :paid_at
|
15
|
+
remove_column :kkt_shoppe_orders, :payment_reference
|
16
|
+
remove_column :kkt_shoppe_orders, :payment_method
|
17
|
+
|
18
|
+
add_column :kkt_shoppe_orders, :amount_paid, :decimal, :precision => 8, :scale => 2, :default => 0.0
|
19
|
+
add_column :kkt_shoppe_orders, :exported, :boolean, :default => false
|
20
|
+
add_column :kkt_shoppe_orders, :invoice_number, :string
|
21
|
+
end
|
22
|
+
|
23
|
+
def down
|
24
|
+
drop_table :kkt_shoppe_payments
|
25
|
+
add_column :kkt_shoppe_orders, :paid_at, :datetime
|
26
|
+
add_column :kkt_shoppe_orders, :payment_reference, :string
|
27
|
+
add_column :kkt_shoppe_orders, :payment_method, :string
|
28
|
+
remove_column :kkt_shoppe_orders, :amount_paid
|
29
|
+
remove_column :kkt_shoppe_orders, :exported
|
30
|
+
remove_column :kkt_shoppe_orders, :invoice_number
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateKktShoppeCustomers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :kkt_shoppe_customers do |t|
|
4
|
+
t.string :first_name
|
5
|
+
t.string :last_name
|
6
|
+
t.string :company
|
7
|
+
t.string :email
|
8
|
+
t.string :phone
|
9
|
+
t.string :mobile
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class AddIndexesToKktShoppeProducts < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
add_index :kkt_shoppe_products, :parent_id
|
4
|
+
add_index :kkt_shoppe_products, :sku
|
5
|
+
add_index :kkt_shoppe_products, :product_category_id
|
6
|
+
add_index :kkt_shoppe_products, :permalink
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
class AddIndexesToKktShoppeStockLevelAdjustments < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
add_index :kkt_shoppe_stock_level_adjustments, [:item_id, :item_type], name: 'index_kkt_shoppe_stock_level_adjustments_items'
|
4
|
+
add_index :kkt_shoppe_stock_level_adjustments, [:parent_id, :parent_type], name: 'index_kkt_shoppe_stock_level_adjustments_parent'
|
5
|
+
end
|
6
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class AddIndexesToKktShoppeDeliveryServices < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
add_index :kkt_shoppe_delivery_services, :active
|
4
|
+
add_index :kkt_shoppe_delivery_service_prices, :delivery_service_id
|
5
|
+
add_index :kkt_shoppe_delivery_service_prices, :min_weight
|
6
|
+
add_index :kkt_shoppe_delivery_service_prices, :max_weight
|
7
|
+
add_index :kkt_shoppe_delivery_service_prices, :price
|
8
|
+
end
|
9
|
+
end
|
data/db/migrate/20141026181717_allow_multiple_kkt_shoppe_products_per_shoppe_product_category.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
class AllowMultipleKktShoppeProductsPerKktShoppeProductCategory < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
# create our join table first before we migrate
|
4
|
+
# we have an id to allow :restrict_with_exception on product_category
|
5
|
+
create_table :kkt_shoppe_product_categorizations do |t|
|
6
|
+
t.integer :product_id, null: false
|
7
|
+
t.integer :product_category_id, null: false
|
8
|
+
end
|
9
|
+
add_index :kkt_shoppe_product_categorizations, :product_id, name: 'categorization_by_product_id'
|
10
|
+
add_index :kkt_shoppe_product_categorizations, :product_category_id, name: 'categorization_by_product_category_id'
|
11
|
+
# define the old belongs_to association (as it's no longer on the model)
|
12
|
+
KktShoppe::Product.class_eval do
|
13
|
+
belongs_to :old_category,
|
14
|
+
:class_name => "KktShoppe::ProductCategory",
|
15
|
+
:foreign_key => "product_category_id"
|
16
|
+
end
|
17
|
+
# migrate over to our new join table
|
18
|
+
KktShoppe::Product.all.each do |product|
|
19
|
+
product.product_categories << product.old_category
|
20
|
+
product.save
|
21
|
+
end
|
22
|
+
# lastly, remove the old product_category_id and associated index
|
23
|
+
remove_index :kkt_shoppe_products, :product_category_id if index_exists?(:kkt_shoppe_products, :product_category_id)
|
24
|
+
remove_column :kkt_shoppe_products, :product_category_id
|
25
|
+
end
|
26
|
+
|
27
|
+
def down
|
28
|
+
# first, we re-add our column so we've got something to populate
|
29
|
+
add_column :kkt_shoppe_products, :product_category_id, :integer
|
30
|
+
add_index :kkt_shoppe_products, :product_category_id
|
31
|
+
# define the old belongs_to association once again as we're going to re-add our goodies
|
32
|
+
KktShoppe::Product.class_eval do
|
33
|
+
belongs_to :new_category,
|
34
|
+
:class_name => "KktShoppe::ProductCategory",
|
35
|
+
:foreign_key => "product_category_id"
|
36
|
+
end
|
37
|
+
# migrate over from the new table to the old association
|
38
|
+
KktShoppe::Product.all.each do |product|
|
39
|
+
next unless product.product_categories.count
|
40
|
+
product.new_category = product.product_categories.first
|
41
|
+
product.save
|
42
|
+
end
|
43
|
+
# drop our join table
|
44
|
+
drop_table :kkt_shoppe_product_categorizations
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class AddNestedToProductCategories < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
add_column :kkt_shoppe_product_categories, :parent_id, :integer
|
4
|
+
add_column :kkt_shoppe_product_categories, :lft, :integer
|
5
|
+
add_column :kkt_shoppe_product_categories, :rgt, :integer
|
6
|
+
add_column :kkt_shoppe_product_categories, :depth, :integer
|
7
|
+
|
8
|
+
add_index :kkt_shoppe_product_categories, :lft
|
9
|
+
add_index :kkt_shoppe_product_categories, :rgt
|
10
|
+
|
11
|
+
add_column :kkt_shoppe_product_categories, :ancestral_permalink, :string
|
12
|
+
add_column :kkt_shoppe_product_categories, :permalink_includes_ancestors, :boolean, default: false
|
13
|
+
|
14
|
+
KktShoppe::ProductCategory.reset_column_information
|
15
|
+
KktShoppe::ProductCategory.rebuild!
|
16
|
+
end
|
17
|
+
|
18
|
+
def down
|
19
|
+
remove_column :kkt_shoppe_product_categories, :ancestral_permalink
|
20
|
+
remove_column :kkt_shoppe_product_categories, :permalink_includes_ancestors
|
21
|
+
|
22
|
+
remove_index :kkt_shoppe_product_categories, :lft
|
23
|
+
remove_index :kkt_shoppe_product_categories, :rgt
|
24
|
+
|
25
|
+
remove_column :kkt_shoppe_product_categories, :parent_id
|
26
|
+
remove_column :kkt_shoppe_product_categories, :lft
|
27
|
+
remove_column :kkt_shoppe_product_categories, :rgt
|
28
|
+
remove_column :kkt_shoppe_product_categories, :depth
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateKktShoppeAddresses < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :kkt_shoppe_addresses do |t|
|
4
|
+
t.belongs_to :customer, index: true
|
5
|
+
t.string :address_type
|
6
|
+
t.boolean :default
|
7
|
+
t.string :address1
|
8
|
+
t.string :address2
|
9
|
+
t.string :address3
|
10
|
+
t.string :address4
|
11
|
+
t.string :postcode
|
12
|
+
t.integer :country_id
|
13
|
+
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|