kylekthompson-shoppe 1.0.7
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/shoppe/chosen-sprite.png +0 -0
- data/app/assets/images/shoppe/chosen-sprite@2x.png +0 -0
- data/app/assets/images/shoppe/document.svg +1 -0
- data/app/assets/images/shoppe/icons/bag.svg +1 -0
- data/app/assets/images/shoppe/icons/balance.svg +1 -0
- data/app/assets/images/shoppe/icons/box.svg +1 -0
- data/app/assets/images/shoppe/icons/building.svg +1 -0
- data/app/assets/images/shoppe/icons/chart.svg +1 -0
- data/app/assets/images/shoppe/icons/chat.svg +1 -0
- data/app/assets/images/shoppe/icons/checkbox.svg +1 -0
- data/app/assets/images/shoppe/icons/checkbox2.svg +1 -0
- data/app/assets/images/shoppe/icons/cloud.svg +1 -0
- data/app/assets/images/shoppe/icons/cone.svg +1 -0
- data/app/assets/images/shoppe/icons/credit_card.svg +1 -0
- data/app/assets/images/shoppe/icons/currency.svg +1 -0
- data/app/assets/images/shoppe/icons/edit.svg +14 -0
- data/app/assets/images/shoppe/icons/flowchart.svg +1 -0
- data/app/assets/images/shoppe/icons/gift.svg +1 -0
- data/app/assets/images/shoppe/icons/globe.svg +1 -0
- data/app/assets/images/shoppe/icons/id.svg +1 -0
- data/app/assets/images/shoppe/icons/id2.svg +1 -0
- data/app/assets/images/shoppe/icons/locked.svg +1 -0
- data/app/assets/images/shoppe/icons/report.svg +1 -0
- data/app/assets/images/shoppe/icons/search.svg +1 -0
- data/app/assets/images/shoppe/icons/support.svg +1 -0
- data/app/assets/images/shoppe/icons/tags.svg +1 -0
- data/app/assets/images/shoppe/icons/toolbox.svg +1 -0
- data/app/assets/images/shoppe/icons/unlocked.svg +1 -0
- data/app/assets/images/shoppe/icons/wallet.svg +1 -0
- data/app/assets/images/shoppe/logo.svg +47 -0
- data/app/assets/images/shoppe/move.svg +1 -0
- data/app/assets/images/shoppe/shoppe.svg +25 -0
- data/app/assets/images/shoppe/square.svg +9 -0
- data/app/assets/images/shoppe/statuses/accepted.svg +14 -0
- data/app/assets/images/shoppe/statuses/paid.svg +16 -0
- data/app/assets/images/shoppe/statuses/received.svg +15 -0
- data/app/assets/images/shoppe/statuses/rejected.svg +14 -0
- data/app/assets/images/shoppe/statuses/shipped.svg +14 -0
- data/app/assets/images/shoppe/table-tear-off.png +0 -0
- data/app/assets/javascripts/shoppe/application.coffee +123 -0
- data/app/assets/javascripts/shoppe/chosen.jquery.js +1166 -0
- data/app/assets/javascripts/shoppe/jquery_ui.js +6 -0
- data/app/assets/javascripts/shoppe/mousetrap.js +9 -0
- data/app/assets/javascripts/shoppe/order_form.coffee +47 -0
- data/app/assets/stylesheets/shoppe/application.scss +601 -0
- data/app/assets/stylesheets/shoppe/chosen.scss +424 -0
- data/app/assets/stylesheets/shoppe/dialog.scss +25 -0
- data/app/assets/stylesheets/shoppe/elements.scss +79 -0
- data/app/assets/stylesheets/shoppe/printable.scss +67 -0
- data/app/assets/stylesheets/shoppe/reset.scss +93 -0
- data/app/assets/stylesheets/shoppe/sub.scss +106 -0
- data/app/assets/stylesheets/shoppe/variables.scss +1 -0
- data/app/controllers/shoppe/addresses_controller.rb +47 -0
- data/app/controllers/shoppe/application_controller.rb +46 -0
- data/app/controllers/shoppe/attachments_controller.rb +14 -0
- data/app/controllers/shoppe/countries_controller.rb +47 -0
- data/app/controllers/shoppe/customers_controller.rb +55 -0
- data/app/controllers/shoppe/dashboard_controller.rb +9 -0
- data/app/controllers/shoppe/delivery_service_prices_controller.rb +45 -0
- data/app/controllers/shoppe/delivery_services_controller.rb +47 -0
- data/app/controllers/shoppe/orders_controller.rb +119 -0
- data/app/controllers/shoppe/payments_controller.rb +33 -0
- data/app/controllers/shoppe/product_categories_controller.rb +47 -0
- data/app/controllers/shoppe/product_category_localisations_controller.rb +58 -0
- data/app/controllers/shoppe/product_localisations_controller.rb +58 -0
- data/app/controllers/shoppe/products_controller.rb +58 -0
- data/app/controllers/shoppe/sessions_controller.rb +34 -0
- data/app/controllers/shoppe/settings_controller.rb +16 -0
- data/app/controllers/shoppe/stock_level_adjustments_controller.rb +40 -0
- data/app/controllers/shoppe/tax_rates_controller.rb +49 -0
- data/app/controllers/shoppe/users_controller.rb +53 -0
- data/app/controllers/shoppe/variants_controller.rb +50 -0
- data/app/helpers/shoppe/application_helper.rb +60 -0
- data/app/helpers/shoppe/product_category_helper.rb +36 -0
- data/app/mailers/shoppe/order_mailer.rb +25 -0
- data/app/mailers/shoppe/user_mailer.rb +10 -0
- data/app/models/shoppe/address.rb +44 -0
- data/app/models/shoppe/country.rb +27 -0
- data/app/models/shoppe/customer.rb +41 -0
- data/app/models/shoppe/delivery_service.rb +33 -0
- data/app/models/shoppe/delivery_service_price.rb +31 -0
- data/app/models/shoppe/order.rb +100 -0
- data/app/models/shoppe/order/actions.rb +94 -0
- data/app/models/shoppe/order/billing.rb +105 -0
- data/app/models/shoppe/order/delivery.rb +229 -0
- data/app/models/shoppe/order/states.rb +69 -0
- data/app/models/shoppe/order_item.rb +239 -0
- data/app/models/shoppe/payment.rb +86 -0
- data/app/models/shoppe/product.rb +189 -0
- data/app/models/shoppe/product/product_attributes.rb +20 -0
- data/app/models/shoppe/product/variants.rb +51 -0
- data/app/models/shoppe/product_attribute.rb +66 -0
- data/app/models/shoppe/product_categorization.rb +14 -0
- data/app/models/shoppe/product_category.rb +75 -0
- data/app/models/shoppe/setting.rb +68 -0
- data/app/models/shoppe/stock_level_adjustment.rb +19 -0
- data/app/models/shoppe/tax_rate.rb +46 -0
- data/app/models/shoppe/user.rb +49 -0
- data/app/validators/permalink_validator.rb +7 -0
- data/app/views/layouts/shoppe/application.html.haml +34 -0
- data/app/views/layouts/shoppe/printable.html.haml +11 -0
- data/app/views/layouts/shoppe/sub.html.haml +10 -0
- data/app/views/shoppe/addresses/_form.html.haml +33 -0
- data/app/views/shoppe/addresses/edit.html.haml +5 -0
- data/app/views/shoppe/addresses/new.html.haml +5 -0
- data/app/views/shoppe/countries/_form.html.haml +35 -0
- data/app/views/shoppe/countries/edit.html.haml +6 -0
- data/app/views/shoppe/countries/index.html.haml +25 -0
- data/app/views/shoppe/countries/new.html.haml +7 -0
- data/app/views/shoppe/customers/_addresses.html.haml +20 -0
- data/app/views/shoppe/customers/_form.html.haml +30 -0
- data/app/views/shoppe/customers/_search_form.html.haml +13 -0
- data/app/views/shoppe/customers/edit.html.haml +5 -0
- data/app/views/shoppe/customers/index.html.haml +32 -0
- data/app/views/shoppe/customers/new.html.haml +5 -0
- data/app/views/shoppe/customers/show.html.haml +53 -0
- data/app/views/shoppe/delivery_service_prices/_form.html.haml +44 -0
- data/app/views/shoppe/delivery_service_prices/edit.html.haml +6 -0
- data/app/views/shoppe/delivery_service_prices/index.html.haml +23 -0
- data/app/views/shoppe/delivery_service_prices/new.html.haml +6 -0
- data/app/views/shoppe/delivery_services/_form.html.haml +38 -0
- data/app/views/shoppe/delivery_services/edit.html.haml +9 -0
- data/app/views/shoppe/delivery_services/index.html.haml +27 -0
- data/app/views/shoppe/delivery_services/new.html.haml +6 -0
- data/app/views/shoppe/order_mailer/accepted.text.erb +12 -0
- data/app/views/shoppe/order_mailer/received.text.erb +9 -0
- data/app/views/shoppe/order_mailer/rejected.text.erb +10 -0
- data/app/views/shoppe/order_mailer/shipped.text.erb +16 -0
- data/app/views/shoppe/orders/_form.html.haml +58 -0
- data/app/views/shoppe/orders/_order_details.html.haml +57 -0
- data/app/views/shoppe/orders/_order_items.html.haml +38 -0
- data/app/views/shoppe/orders/_order_items_form.html.haml +61 -0
- data/app/views/shoppe/orders/_payments_form.html.haml +15 -0
- data/app/views/shoppe/orders/_payments_table.html.haml +37 -0
- data/app/views/shoppe/orders/_search_form.html.haml +24 -0
- data/app/views/shoppe/orders/_status_bar.html.haml +35 -0
- data/app/views/shoppe/orders/despatch_note.html.haml +45 -0
- data/app/views/shoppe/orders/edit.html.haml +21 -0
- data/app/views/shoppe/orders/index.html.haml +39 -0
- data/app/views/shoppe/orders/new.html.haml +14 -0
- data/app/views/shoppe/orders/show.html.haml +25 -0
- data/app/views/shoppe/payments/refund.html.haml +13 -0
- data/app/views/shoppe/product_categories/_form.html.haml +50 -0
- data/app/views/shoppe/product_categories/edit.html.haml +8 -0
- data/app/views/shoppe/product_categories/index.html.haml +27 -0
- data/app/views/shoppe/product_categories/new.html.haml +6 -0
- data/app/views/shoppe/product_category_localisations/form.html.haml +29 -0
- data/app/views/shoppe/product_category_localisations/index.html.haml +26 -0
- data/app/views/shoppe/product_localisations/form.html.haml +32 -0
- data/app/views/shoppe/product_localisations/index.html.haml +26 -0
- data/app/views/shoppe/products/_form.html.haml +118 -0
- data/app/views/shoppe/products/_table.html.haml +42 -0
- data/app/views/shoppe/products/edit.html.haml +9 -0
- data/app/views/shoppe/products/import.html.haml +67 -0
- data/app/views/shoppe/products/index.html.haml +9 -0
- data/app/views/shoppe/products/new.html.haml +7 -0
- data/app/views/shoppe/sessions/new.html.haml +12 -0
- data/app/views/shoppe/sessions/reset.html.haml +12 -0
- data/app/views/shoppe/settings/edit.html.haml +19 -0
- data/app/views/shoppe/shared/error.html.haml +6 -0
- data/app/views/shoppe/stock_level_adjustments/index.html.haml +40 -0
- data/app/views/shoppe/tax_rates/form.html.haml +28 -0
- data/app/views/shoppe/tax_rates/index.html.haml +17 -0
- data/app/views/shoppe/user_mailer/new_password.text.erb +9 -0
- data/app/views/shoppe/users/_form.html.haml +27 -0
- data/app/views/shoppe/users/edit.html.haml +5 -0
- data/app/views/shoppe/users/index.html.haml +17 -0
- data/app/views/shoppe/users/new.html.haml +7 -0
- data/app/views/shoppe/variants/form.html.haml +68 -0
- data/app/views/shoppe/variants/index.html.haml +33 -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_shoppe_initial_schema.rb +175 -0
- data/db/migrate/20131024201501_add_address_type_to_shoppe_tax_rates.rb +5 -0
- data/db/migrate/20131024204815_create_shoppe_payments.rb +32 -0
- data/db/migrate/20131102143930_remove_default_on_order_item_weight.rb +9 -0
- data/db/migrate/20141013192427_create_shoppe_customers.rb +14 -0
- data/db/migrate/20141026175622_add_indexes_to_shoppe_order_items.rb +6 -0
- data/db/migrate/20141026175943_add_indexes_to_shoppe_orders.rb +7 -0
- data/db/migrate/20141026180333_add_indexes_to_shoppe_payments.rb +6 -0
- data/db/migrate/20141026180835_add_indexes_to_shoppe_product_attributes.rb +7 -0
- data/db/migrate/20141026180952_add_indexes_to_shoppe_product_categories.rb +5 -0
- data/db/migrate/20141026181040_add_indexes_to_shoppe_products.rb +8 -0
- data/db/migrate/20141026181312_add_indexes_to_shoppe_settings.rb +5 -0
- data/db/migrate/20141026181354_add_indexes_to_shoppe_stock_level_adjustments.rb +6 -0
- data/db/migrate/20141026181559_add_indexes_to_shoppe_users.rb +5 -0
- data/db/migrate/20141026181716_add_indexes_to_shoppe_delivery_services.rb +9 -0
- data/db/migrate/20141026181717_allow_multiple_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_shoppe_addresses.rb +17 -0
- data/db/migrate/20150315215633_add_customer_to_shoppe_orders.rb +5 -0
- data/db/migrate/20150513171350_create_shoppe_product_category_translation_table.rb +17 -0
- data/db/migrate/20150519173350_create_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/shoppe.rb +60 -0
- data/lib/shoppe/associated_countries.rb +20 -0
- data/lib/shoppe/country_importer.rb +15 -0
- data/lib/shoppe/default_navigation.rb +21 -0
- data/lib/shoppe/engine.rb +55 -0
- data/lib/shoppe/error.rb +21 -0
- data/lib/shoppe/errors/inappropriate_delivery_service.rb +6 -0
- data/lib/shoppe/errors/insufficient_stock_to_fulfil.rb +15 -0
- data/lib/shoppe/errors/invalid_configuration.rb +6 -0
- data/lib/shoppe/errors/not_enough_stock.rb +15 -0
- data/lib/shoppe/errors/payment_declined.rb +6 -0
- data/lib/shoppe/errors/refund_failed.rb +6 -0
- data/lib/shoppe/errors/unorderable_item.rb +6 -0
- data/lib/shoppe/navigation_manager.rb +81 -0
- data/lib/shoppe/orderable_item.rb +39 -0
- data/lib/shoppe/settings.rb +26 -0
- data/lib/shoppe/settings_loader.rb +16 -0
- data/lib/shoppe/setup_generator.rb +10 -0
- data/lib/shoppe/version.rb +3 -0
- data/lib/shoppe/view_helpers.rb +16 -0
- data/lib/tasks/shoppe.rake +29 -0
- metadata +662 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
class CreateShoppePayments < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
create_table :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 :shoppe_orders, :paid_at
|
15
|
+
remove_column :shoppe_orders, :payment_reference
|
16
|
+
remove_column :shoppe_orders, :payment_method
|
17
|
+
|
18
|
+
add_column :shoppe_orders, :amount_paid, :decimal, :precision => 8, :scale => 2, :default => 0.0
|
19
|
+
add_column :shoppe_orders, :exported, :boolean, :default => false
|
20
|
+
add_column :shoppe_orders, :invoice_number, :string
|
21
|
+
end
|
22
|
+
|
23
|
+
def down
|
24
|
+
drop_table :shoppe_payments
|
25
|
+
add_column :shoppe_orders, :paid_at, :datetime
|
26
|
+
add_column :shoppe_orders, :payment_reference, :string
|
27
|
+
add_column :shoppe_orders, :payment_method, :string
|
28
|
+
remove_column :shoppe_orders, :amount_paid
|
29
|
+
remove_column :shoppe_orders, :exported
|
30
|
+
remove_column :shoppe_orders, :invoice_number
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateShoppeCustomers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :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,6 @@
|
|
1
|
+
class AddIndexesToShoppeStockLevelAdjustments < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
add_index :shoppe_stock_level_adjustments, [:item_id, :item_type], name: 'index_shoppe_stock_level_adjustments_items'
|
4
|
+
add_index :shoppe_stock_level_adjustments, [:parent_id, :parent_type], name: 'index_shoppe_stock_level_adjustments_parent'
|
5
|
+
end
|
6
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class AddIndexesToShoppeDeliveryServices < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
add_index :shoppe_delivery_services, :active
|
4
|
+
add_index :shoppe_delivery_service_prices, :delivery_service_id
|
5
|
+
add_index :shoppe_delivery_service_prices, :min_weight
|
6
|
+
add_index :shoppe_delivery_service_prices, :max_weight
|
7
|
+
add_index :shoppe_delivery_service_prices, :price
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
class AllowMultipleShoppeProductsPerShoppeProductCategory < 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 :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 :shoppe_product_categorizations, :product_id, name: 'categorization_by_product_id'
|
10
|
+
add_index :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
|
+
Shoppe::Product.class_eval do
|
13
|
+
belongs_to :old_category,
|
14
|
+
:class_name => "Shoppe::ProductCategory",
|
15
|
+
:foreign_key => "product_category_id"
|
16
|
+
end
|
17
|
+
# migrate over to our new join table
|
18
|
+
Shoppe::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 :shoppe_products, :product_category_id if index_exists?(:shoppe_products, :product_category_id)
|
24
|
+
remove_column :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 :shoppe_products, :product_category_id, :integer
|
30
|
+
add_index :shoppe_products, :product_category_id
|
31
|
+
# define the old belongs_to association once again as we're going to re-add our goodies
|
32
|
+
Shoppe::Product.class_eval do
|
33
|
+
belongs_to :new_category,
|
34
|
+
:class_name => "Shoppe::ProductCategory",
|
35
|
+
:foreign_key => "product_category_id"
|
36
|
+
end
|
37
|
+
# migrate over from the new table to the old association
|
38
|
+
Shoppe::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 :shoppe_product_categorizations
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class AddNestedToProductCategories < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
add_column :shoppe_product_categories, :parent_id, :integer
|
4
|
+
add_column :shoppe_product_categories, :lft, :integer
|
5
|
+
add_column :shoppe_product_categories, :rgt, :integer
|
6
|
+
add_column :shoppe_product_categories, :depth, :integer
|
7
|
+
|
8
|
+
add_index :shoppe_product_categories, :lft
|
9
|
+
add_index :shoppe_product_categories, :rgt
|
10
|
+
|
11
|
+
add_column :shoppe_product_categories, :ancestral_permalink, :string
|
12
|
+
add_column :shoppe_product_categories, :permalink_includes_ancestors, :boolean, default: false
|
13
|
+
|
14
|
+
Shoppe::ProductCategory.reset_column_information
|
15
|
+
Shoppe::ProductCategory.rebuild!
|
16
|
+
end
|
17
|
+
|
18
|
+
def down
|
19
|
+
remove_column :shoppe_product_categories, :ancestral_permalink
|
20
|
+
remove_column :shoppe_product_categories, :permalink_includes_ancestors
|
21
|
+
|
22
|
+
remove_index :shoppe_product_categories, :lft
|
23
|
+
remove_index :shoppe_product_categories, :rgt
|
24
|
+
|
25
|
+
remove_column :shoppe_product_categories, :parent_id
|
26
|
+
remove_column :shoppe_product_categories, :lft
|
27
|
+
remove_column :shoppe_product_categories, :rgt
|
28
|
+
remove_column :shoppe_product_categories, :depth
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateShoppeAddresses < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :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
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateShoppeProductCategoryTranslationTable < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
Shoppe::ProductCategory.create_translation_table! :name => :string, :permalink => :string, :description => :text
|
4
|
+
|
5
|
+
Shoppe::ProductCategory.all.each do |pc|
|
6
|
+
l = pc.translations.new
|
7
|
+
l.locale = "en"
|
8
|
+
l.name = pc.name
|
9
|
+
l.permalink = pc.permalink
|
10
|
+
l.description = pc.description
|
11
|
+
l.save!
|
12
|
+
end
|
13
|
+
end
|
14
|
+
def down
|
15
|
+
Shoppe::ProductCategory.drop_translation_table!
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateShoppeProductTranslationTable < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
Shoppe::Product.create_translation_table! :name => :string, :permalink => :string, :description => :text, :short_description => :text
|
4
|
+
|
5
|
+
Shoppe::Product.all.each do |p|
|
6
|
+
l = p.translations.new
|
7
|
+
l.locale = "en"
|
8
|
+
l.name = p.name
|
9
|
+
l.permalink = p.permalink
|
10
|
+
l.description = p.description
|
11
|
+
l.short_description = p.short_description
|
12
|
+
l.save!
|
13
|
+
end
|
14
|
+
end
|
15
|
+
def down
|
16
|
+
Shoppe::Product.drop_translation_table!
|
17
|
+
end
|
18
|
+
end
|
data/db/schema.rb
ADDED
@@ -0,0 +1,308 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended that you check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(version: 20150315223628) do
|
15
|
+
|
16
|
+
create_table "nifty_attachments", force: true do |t|
|
17
|
+
t.integer "parent_id"
|
18
|
+
t.string "parent_type"
|
19
|
+
t.string "token"
|
20
|
+
t.string "digest"
|
21
|
+
t.string "role"
|
22
|
+
t.string "file_name"
|
23
|
+
t.string "file_type"
|
24
|
+
t.binary "data", limit: 16777215
|
25
|
+
t.datetime "created_at"
|
26
|
+
t.datetime "updated_at"
|
27
|
+
end
|
28
|
+
|
29
|
+
create_table "nifty_key_value_store", force: true do |t|
|
30
|
+
t.integer "parent_id"
|
31
|
+
t.string "parent_type"
|
32
|
+
t.string "group"
|
33
|
+
t.string "name"
|
34
|
+
t.string "value"
|
35
|
+
end
|
36
|
+
|
37
|
+
create_table "shoppe_addresses", force: true do |t|
|
38
|
+
t.integer "customer_id"
|
39
|
+
t.string "address_type"
|
40
|
+
t.boolean "default"
|
41
|
+
t.string "address1"
|
42
|
+
t.string "address2"
|
43
|
+
t.string "address3"
|
44
|
+
t.string "address4"
|
45
|
+
t.string "postcode"
|
46
|
+
t.integer "country_id"
|
47
|
+
t.datetime "created_at"
|
48
|
+
t.datetime "updated_at"
|
49
|
+
end
|
50
|
+
|
51
|
+
add_index "shoppe_addresses", ["customer_id"], name: "index_shoppe_addresses_on_customer_id", using: :btree
|
52
|
+
|
53
|
+
create_table "shoppe_attachments", force: true do |t|
|
54
|
+
t.integer "parent_id", null: false
|
55
|
+
t.string "parent_type", null: false
|
56
|
+
t.string "token"
|
57
|
+
t.string "file", null: false
|
58
|
+
t.string "file_name"
|
59
|
+
t.integer "file_size"
|
60
|
+
t.string "file_type"
|
61
|
+
t.string "role"
|
62
|
+
t.datetime "created_at"
|
63
|
+
t.datetime "updated_at"
|
64
|
+
end
|
65
|
+
|
66
|
+
create_table "shoppe_countries", force: true do |t|
|
67
|
+
t.string "name"
|
68
|
+
t.string "code2"
|
69
|
+
t.string "code3"
|
70
|
+
t.string "continent"
|
71
|
+
t.string "tld"
|
72
|
+
t.string "currency"
|
73
|
+
t.boolean "eu_member", default: false
|
74
|
+
end
|
75
|
+
|
76
|
+
create_table "shoppe_customers", force: true do |t|
|
77
|
+
t.string "first_name"
|
78
|
+
t.string "last_name"
|
79
|
+
t.string "company"
|
80
|
+
t.string "email"
|
81
|
+
t.string "phone"
|
82
|
+
t.string "mobile"
|
83
|
+
t.datetime "created_at"
|
84
|
+
t.datetime "updated_at"
|
85
|
+
end
|
86
|
+
|
87
|
+
create_table "shoppe_delivery_service_prices", force: true do |t|
|
88
|
+
t.integer "delivery_service_id"
|
89
|
+
t.string "code"
|
90
|
+
t.decimal "price", precision: 8, scale: 2
|
91
|
+
t.decimal "cost_price", precision: 8, scale: 2
|
92
|
+
t.integer "tax_rate_id"
|
93
|
+
t.decimal "min_weight", precision: 8, scale: 2
|
94
|
+
t.decimal "max_weight", precision: 8, scale: 2
|
95
|
+
t.datetime "created_at"
|
96
|
+
t.datetime "updated_at"
|
97
|
+
t.text "country_ids"
|
98
|
+
end
|
99
|
+
|
100
|
+
add_index "shoppe_delivery_service_prices", ["delivery_service_id"], name: "index_shoppe_delivery_service_prices_on_delivery_service_id", using: :btree
|
101
|
+
add_index "shoppe_delivery_service_prices", ["max_weight"], name: "index_shoppe_delivery_service_prices_on_max_weight", using: :btree
|
102
|
+
add_index "shoppe_delivery_service_prices", ["min_weight"], name: "index_shoppe_delivery_service_prices_on_min_weight", using: :btree
|
103
|
+
add_index "shoppe_delivery_service_prices", ["price"], name: "index_shoppe_delivery_service_prices_on_price", using: :btree
|
104
|
+
|
105
|
+
create_table "shoppe_delivery_services", force: true do |t|
|
106
|
+
t.string "name"
|
107
|
+
t.string "code"
|
108
|
+
t.boolean "default", default: false
|
109
|
+
t.boolean "active", default: true
|
110
|
+
t.datetime "created_at"
|
111
|
+
t.datetime "updated_at"
|
112
|
+
t.string "courier"
|
113
|
+
t.string "tracking_url"
|
114
|
+
end
|
115
|
+
|
116
|
+
add_index "shoppe_delivery_services", ["active"], name: "index_shoppe_delivery_services_on_active", using: :btree
|
117
|
+
|
118
|
+
create_table "shoppe_order_items", force: true do |t|
|
119
|
+
t.integer "order_id"
|
120
|
+
t.integer "ordered_item_id"
|
121
|
+
t.string "ordered_item_type"
|
122
|
+
t.integer "quantity", default: 1
|
123
|
+
t.decimal "unit_price", precision: 8, scale: 2
|
124
|
+
t.decimal "unit_cost_price", precision: 8, scale: 2
|
125
|
+
t.decimal "tax_amount", precision: 8, scale: 2
|
126
|
+
t.decimal "tax_rate", precision: 8, scale: 2
|
127
|
+
t.decimal "weight", precision: 8, scale: 3
|
128
|
+
t.datetime "created_at"
|
129
|
+
t.datetime "updated_at"
|
130
|
+
end
|
131
|
+
|
132
|
+
add_index "shoppe_order_items", ["order_id"], name: "index_shoppe_order_items_on_order_id", using: :btree
|
133
|
+
add_index "shoppe_order_items", ["ordered_item_id", "ordered_item_type"], name: "index_shoppe_order_items_ordered_item", using: :btree
|
134
|
+
|
135
|
+
create_table "shoppe_orders", force: true do |t|
|
136
|
+
t.string "token"
|
137
|
+
t.string "first_name"
|
138
|
+
t.string "last_name"
|
139
|
+
t.string "company"
|
140
|
+
t.string "billing_address1"
|
141
|
+
t.string "billing_address2"
|
142
|
+
t.string "billing_address3"
|
143
|
+
t.string "billing_address4"
|
144
|
+
t.string "billing_postcode"
|
145
|
+
t.integer "billing_country_id"
|
146
|
+
t.string "email_address"
|
147
|
+
t.string "phone_number"
|
148
|
+
t.string "status"
|
149
|
+
t.datetime "received_at"
|
150
|
+
t.datetime "accepted_at"
|
151
|
+
t.datetime "shipped_at"
|
152
|
+
t.datetime "created_at"
|
153
|
+
t.datetime "updated_at"
|
154
|
+
t.integer "delivery_service_id"
|
155
|
+
t.decimal "delivery_price", precision: 8, scale: 2
|
156
|
+
t.decimal "delivery_cost_price", precision: 8, scale: 2
|
157
|
+
t.decimal "delivery_tax_rate", precision: 8, scale: 2
|
158
|
+
t.decimal "delivery_tax_amount", precision: 8, scale: 2
|
159
|
+
t.integer "accepted_by"
|
160
|
+
t.integer "shipped_by"
|
161
|
+
t.string "consignment_number"
|
162
|
+
t.datetime "rejected_at"
|
163
|
+
t.integer "rejected_by"
|
164
|
+
t.string "ip_address"
|
165
|
+
t.text "notes"
|
166
|
+
t.boolean "separate_delivery_address", default: false
|
167
|
+
t.string "delivery_name"
|
168
|
+
t.string "delivery_address1"
|
169
|
+
t.string "delivery_address2"
|
170
|
+
t.string "delivery_address3"
|
171
|
+
t.string "delivery_address4"
|
172
|
+
t.string "delivery_postcode"
|
173
|
+
t.integer "delivery_country_id"
|
174
|
+
t.decimal "amount_paid", precision: 8, scale: 2, default: 0.0
|
175
|
+
t.boolean "exported", default: false
|
176
|
+
t.string "invoice_number"
|
177
|
+
t.integer "customer_id"
|
178
|
+
end
|
179
|
+
|
180
|
+
add_index "shoppe_orders", ["delivery_service_id"], name: "index_shoppe_orders_on_delivery_service_id", using: :btree
|
181
|
+
add_index "shoppe_orders", ["received_at"], name: "index_shoppe_orders_on_received_at", using: :btree
|
182
|
+
add_index "shoppe_orders", ["token"], name: "index_shoppe_orders_on_token", using: :btree
|
183
|
+
|
184
|
+
create_table "shoppe_payments", force: true do |t|
|
185
|
+
t.integer "order_id"
|
186
|
+
t.decimal "amount", precision: 8, scale: 2, default: 0.0
|
187
|
+
t.string "reference"
|
188
|
+
t.string "method"
|
189
|
+
t.boolean "confirmed", default: true
|
190
|
+
t.boolean "refundable", default: false
|
191
|
+
t.decimal "amount_refunded", precision: 8, scale: 2, default: 0.0
|
192
|
+
t.integer "parent_payment_id"
|
193
|
+
t.boolean "exported", default: false
|
194
|
+
t.datetime "created_at"
|
195
|
+
t.datetime "updated_at"
|
196
|
+
end
|
197
|
+
|
198
|
+
add_index "shoppe_payments", ["order_id"], name: "index_shoppe_payments_on_order_id", using: :btree
|
199
|
+
add_index "shoppe_payments", ["parent_payment_id"], name: "index_shoppe_payments_on_parent_payment_id", using: :btree
|
200
|
+
|
201
|
+
create_table "shoppe_product_attributes", force: true do |t|
|
202
|
+
t.integer "product_id"
|
203
|
+
t.string "key"
|
204
|
+
t.string "value"
|
205
|
+
t.integer "position", default: 1
|
206
|
+
t.boolean "searchable", default: true
|
207
|
+
t.datetime "created_at"
|
208
|
+
t.datetime "updated_at"
|
209
|
+
t.boolean "public", default: true
|
210
|
+
end
|
211
|
+
|
212
|
+
add_index "shoppe_product_attributes", ["key"], name: "index_shoppe_product_attributes_on_key", using: :btree
|
213
|
+
add_index "shoppe_product_attributes", ["position"], name: "index_shoppe_product_attributes_on_position", using: :btree
|
214
|
+
add_index "shoppe_product_attributes", ["product_id"], name: "index_shoppe_product_attributes_on_product_id", using: :btree
|
215
|
+
|
216
|
+
create_table "shoppe_product_categories", force: true do |t|
|
217
|
+
t.string "name"
|
218
|
+
t.string "permalink"
|
219
|
+
t.text "description"
|
220
|
+
t.datetime "created_at"
|
221
|
+
t.datetime "updated_at"
|
222
|
+
t.integer "parent_id"
|
223
|
+
t.integer "lft"
|
224
|
+
t.integer "rgt"
|
225
|
+
t.integer "depth"
|
226
|
+
t.string "ancestral_permalink"
|
227
|
+
t.boolean "permalink_includes_ancestors", default: false
|
228
|
+
end
|
229
|
+
|
230
|
+
add_index "shoppe_product_categories", ["lft"], name: "index_shoppe_product_categories_on_lft", using: :btree
|
231
|
+
add_index "shoppe_product_categories", ["permalink"], name: "index_shoppe_product_categories_on_permalink", using: :btree
|
232
|
+
add_index "shoppe_product_categories", ["rgt"], name: "index_shoppe_product_categories_on_rgt", using: :btree
|
233
|
+
|
234
|
+
create_table "shoppe_product_categorizations", force: true do |t|
|
235
|
+
t.integer "product_id", null: false
|
236
|
+
t.integer "product_category_id", null: false
|
237
|
+
end
|
238
|
+
|
239
|
+
add_index "shoppe_product_categorizations", ["product_category_id"], name: "categorization_by_product_category_id", using: :btree
|
240
|
+
add_index "shoppe_product_categorizations", ["product_id"], name: "categorization_by_product_id", using: :btree
|
241
|
+
|
242
|
+
create_table "shoppe_products", force: true do |t|
|
243
|
+
t.integer "parent_id"
|
244
|
+
t.string "name"
|
245
|
+
t.string "sku"
|
246
|
+
t.string "permalink"
|
247
|
+
t.text "description"
|
248
|
+
t.text "short_description"
|
249
|
+
t.boolean "active", default: true
|
250
|
+
t.decimal "weight", precision: 8, scale: 3, default: 0.0
|
251
|
+
t.decimal "price", precision: 8, scale: 2, default: 0.0
|
252
|
+
t.decimal "cost_price", precision: 8, scale: 2, default: 0.0
|
253
|
+
t.integer "tax_rate_id"
|
254
|
+
t.datetime "created_at"
|
255
|
+
t.datetime "updated_at"
|
256
|
+
t.boolean "featured", default: false
|
257
|
+
t.text "in_the_box"
|
258
|
+
t.boolean "stock_control", default: true
|
259
|
+
t.boolean "default", default: false
|
260
|
+
end
|
261
|
+
|
262
|
+
add_index "shoppe_products", ["parent_id"], name: "index_shoppe_products_on_parent_id", using: :btree
|
263
|
+
add_index "shoppe_products", ["permalink"], name: "index_shoppe_products_on_permalink", using: :btree
|
264
|
+
add_index "shoppe_products", ["sku"], name: "index_shoppe_products_on_sku", using: :btree
|
265
|
+
|
266
|
+
create_table "shoppe_settings", force: true do |t|
|
267
|
+
t.string "key"
|
268
|
+
t.string "value"
|
269
|
+
t.string "value_type"
|
270
|
+
end
|
271
|
+
|
272
|
+
add_index "shoppe_settings", ["key"], name: "index_shoppe_settings_on_key", using: :btree
|
273
|
+
|
274
|
+
create_table "shoppe_stock_level_adjustments", force: true do |t|
|
275
|
+
t.integer "item_id"
|
276
|
+
t.string "item_type"
|
277
|
+
t.string "description"
|
278
|
+
t.integer "adjustment", default: 0
|
279
|
+
t.string "parent_type"
|
280
|
+
t.integer "parent_id"
|
281
|
+
t.datetime "created_at"
|
282
|
+
t.datetime "updated_at"
|
283
|
+
end
|
284
|
+
|
285
|
+
add_index "shoppe_stock_level_adjustments", ["item_id", "item_type"], name: "index_shoppe_stock_level_adjustments_items", using: :btree
|
286
|
+
add_index "shoppe_stock_level_adjustments", ["parent_id", "parent_type"], name: "index_shoppe_stock_level_adjustments_parent", using: :btree
|
287
|
+
|
288
|
+
create_table "shoppe_tax_rates", force: true do |t|
|
289
|
+
t.string "name"
|
290
|
+
t.decimal "rate", precision: 8, scale: 2
|
291
|
+
t.datetime "created_at"
|
292
|
+
t.datetime "updated_at"
|
293
|
+
t.text "country_ids"
|
294
|
+
t.string "address_type"
|
295
|
+
end
|
296
|
+
|
297
|
+
create_table "shoppe_users", force: true do |t|
|
298
|
+
t.string "first_name"
|
299
|
+
t.string "last_name"
|
300
|
+
t.string "email_address"
|
301
|
+
t.string "password_digest"
|
302
|
+
t.datetime "created_at"
|
303
|
+
t.datetime "updated_at"
|
304
|
+
end
|
305
|
+
|
306
|
+
add_index "shoppe_users", ["email_address"], name: "index_shoppe_users_on_email_address", using: :btree
|
307
|
+
|
308
|
+
end
|