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
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateKktShoppeProductCategoryTranslationTable < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
KktShoppe::ProductCategory.create_translation_table! :name => :string, :permalink => :string, :description => :text
|
4
|
+
|
5
|
+
KktShoppe::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
|
+
KktShoppe::ProductCategory.drop_translation_table!
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateKktShoppeProductTranslationTable < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
KktShoppe::Product.create_translation_table! :name => :string, :permalink => :string, :description => :text, :short_description => :text
|
4
|
+
|
5
|
+
KktShoppe::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
|
+
KktShoppe::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 "kkt_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 "kkt_shoppe_addresses", ["customer_id"], name: "index_kkt_shoppe_addresses_on_customer_id", using: :btree
|
52
|
+
|
53
|
+
create_table "kkt_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 "kkt_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 "kkt_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 "kkt_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 "kkt_shoppe_delivery_service_prices", ["delivery_service_id"], name: "index_kkt_shoppe_delivery_service_prices_on_delivery_service_id", using: :btree
|
101
|
+
add_index "kkt_shoppe_delivery_service_prices", ["max_weight"], name: "index_kkt_shoppe_delivery_service_prices_on_max_weight", using: :btree
|
102
|
+
add_index "kkt_shoppe_delivery_service_prices", ["min_weight"], name: "index_kkt_shoppe_delivery_service_prices_on_min_weight", using: :btree
|
103
|
+
add_index "kkt_shoppe_delivery_service_prices", ["price"], name: "index_kkt_shoppe_delivery_service_prices_on_price", using: :btree
|
104
|
+
|
105
|
+
create_table "kkt_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 "kkt_shoppe_delivery_services", ["active"], name: "index_kkt_shoppe_delivery_services_on_active", using: :btree
|
117
|
+
|
118
|
+
create_table "kkt_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 "kkt_shoppe_order_items", ["order_id"], name: "index_kkt_shoppe_order_items_on_order_id", using: :btree
|
133
|
+
add_index "kkt_shoppe_order_items", ["ordered_item_id", "ordered_item_type"], name: "index_kkt_shoppe_order_items_ordered_item", using: :btree
|
134
|
+
|
135
|
+
create_table "kkt_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 "kkt_shoppe_orders", ["delivery_service_id"], name: "index_kkt_shoppe_orders_on_delivery_service_id", using: :btree
|
181
|
+
add_index "kkt_shoppe_orders", ["received_at"], name: "index_kkt_shoppe_orders_on_received_at", using: :btree
|
182
|
+
add_index "kkt_shoppe_orders", ["token"], name: "index_kkt_shoppe_orders_on_token", using: :btree
|
183
|
+
|
184
|
+
create_table "kkt_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 "kkt_shoppe_payments", ["order_id"], name: "index_kkt_shoppe_payments_on_order_id", using: :btree
|
199
|
+
add_index "kkt_shoppe_payments", ["parent_payment_id"], name: "index_kkt_shoppe_payments_on_parent_payment_id", using: :btree
|
200
|
+
|
201
|
+
create_table "kkt_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 "kkt_shoppe_product_attributes", ["key"], name: "index_kkt_shoppe_product_attributes_on_key", using: :btree
|
213
|
+
add_index "kkt_shoppe_product_attributes", ["position"], name: "index_kkt_shoppe_product_attributes_on_position", using: :btree
|
214
|
+
add_index "kkt_shoppe_product_attributes", ["product_id"], name: "index_kkt_shoppe_product_attributes_on_product_id", using: :btree
|
215
|
+
|
216
|
+
create_table "kkt_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 "kkt_shoppe_product_categories", ["lft"], name: "index_kkt_shoppe_product_categories_on_lft", using: :btree
|
231
|
+
add_index "kkt_shoppe_product_categories", ["permalink"], name: "index_kkt_shoppe_product_categories_on_permalink", using: :btree
|
232
|
+
add_index "kkt_shoppe_product_categories", ["rgt"], name: "index_kkt_shoppe_product_categories_on_rgt", using: :btree
|
233
|
+
|
234
|
+
create_table "kkt_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 "kkt_shoppe_product_categorizations", ["product_category_id"], name: "categorization_by_product_category_id", using: :btree
|
240
|
+
add_index "kkt_shoppe_product_categorizations", ["product_id"], name: "categorization_by_product_id", using: :btree
|
241
|
+
|
242
|
+
create_table "kkt_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 "kkt_shoppe_products", ["parent_id"], name: "index_kkt_shoppe_products_on_parent_id", using: :btree
|
263
|
+
add_index "kkt_shoppe_products", ["permalink"], name: "index_kkt_shoppe_products_on_permalink", using: :btree
|
264
|
+
add_index "kkt_shoppe_products", ["sku"], name: "index_kkt_shoppe_products_on_sku", using: :btree
|
265
|
+
|
266
|
+
create_table "kkt_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 "kkt_shoppe_settings", ["key"], name: "index_kkt_shoppe_settings_on_key", using: :btree
|
273
|
+
|
274
|
+
create_table "kkt_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 "kkt_shoppe_stock_level_adjustments", ["item_id", "item_type"], name: "index_kkt_shoppe_stock_level_adjustments_items", using: :btree
|
286
|
+
add_index "kkt_shoppe_stock_level_adjustments", ["parent_id", "parent_type"], name: "index_kkt_shoppe_stock_level_adjustments_parent", using: :btree
|
287
|
+
|
288
|
+
create_table "kkt_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 "kkt_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 "kkt_shoppe_users", ["email_address"], name: "index_kkt_shoppe_users_on_email_address", using: :btree
|
307
|
+
|
308
|
+
end
|
data/db/seeds.rb
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# tax rates
|
4
|
+
tax_rate = KktShoppe::TaxRate.create!(:name => "Standard VAT", :rate => 20.0)
|
5
|
+
exempt_tax = KktShoppe::TaxRate.create!(:name => "Exempt VAT", :rate => 0.0)
|
6
|
+
|
7
|
+
# delivery services
|
8
|
+
|
9
|
+
ds = KktShoppe::DeliveryService.create!(:name => "Next Day Delivery", :code => 'ND16', :courier => 'AnyCourier', :tracking_url => 'http://trackingurl.com/track/{{consignment_number}}')
|
10
|
+
ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 0, :max_weight => 1, :price => 5.0, :cost_price => 4.50, :tax_rate => tax_rate)
|
11
|
+
ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 1, :max_weight => 5, :price => 8.0, :cost_price => 7.5, :tax_rate => tax_rate)
|
12
|
+
ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 5, :max_weight => 20, :price => 10.0, :cost_price => 9.50, :tax_rate => tax_rate)
|
13
|
+
|
14
|
+
ds = KktShoppe::DeliveryService.create!(:name => "Saturday Delivery", :code => 'NDSA16', :courier => 'AnyCourier', :tracking_url => 'http://trackingurl.com/track/{{consignment_number}}')
|
15
|
+
ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 0, :max_weight => 1, :price => 27.0, :cost_price => 24.00, :tax_rate => tax_rate)
|
16
|
+
ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 1, :max_weight => 5, :price => 29.0, :cost_price => 20.00, :tax_rate => tax_rate)
|
17
|
+
ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 5, :max_weight => 20, :price => 37.0, :cost_price => 32.00,:tax_rate => tax_rate)
|
18
|
+
|
19
|
+
# categories
|
20
|
+
cat1 = KktShoppe::ProductCategory.create!(:name => 'VoIP Phones')
|
21
|
+
cat2 = KktShoppe::ProductCategory.create!(:name => 'VoIP Accessories')
|
22
|
+
cat3 = KktShoppe::ProductCategory.create!(:name => 'Network Eqipment')
|
23
|
+
|
24
|
+
def get_file(name, content_type = 'image/jpeg')
|
25
|
+
file = ActionDispatch::Http::UploadedFile.new(:tempfile => File.open(File.join(KktShoppe.root, 'db', 'seeds_data', name), 'rb'))
|
26
|
+
file.original_filename = name
|
27
|
+
file.content_type = content_type
|
28
|
+
file
|
29
|
+
end
|
30
|
+
|
31
|
+
lorem = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
|
32
|
+
|
33
|
+
pro = KktShoppe::Product.new(:name => 'Yealink T20P', :sku => 'YL-SIP-T20P', :description => lorem, :short_description => 'If cheap & cheerful is what you’re after, the Yealink T20P is what you’re looking for.', :weight => 1.119, :price => 54.99, :cost_price => 44.99, :tax_rate => tax_rate, :featured => true)
|
34
|
+
pro.product_category_ids = cat1.id
|
35
|
+
pro.default_image_file = get_file('t20p.jpg')
|
36
|
+
pro.save!
|
37
|
+
pro.stock_level_adjustments.create(:description => 'Initial Stock', :adjustment => 17)
|
38
|
+
pro.product_attributes.create!(:key => 'Manufacturer', :value => 'Yealink', :position => 1)
|
39
|
+
pro.product_attributes.create!(:key => 'Model', :value => 'T20P', :position => 1)
|
40
|
+
pro.product_attributes.create!(:key => 'Colour', :value => 'Black', :position => 1)
|
41
|
+
pro.product_attributes.create!(:key => 'Lines', :value => '3', :position => 1)
|
42
|
+
pro.product_attributes.create!(:key => 'Colour Screen?', :value => 'No', :position => 1)
|
43
|
+
pro.product_attributes.create!(:key => 'Power over ethernet?', :value => 'Yes', :position => 1)
|
44
|
+
|
45
|
+
pro = KktShoppe::Product.new(:name => 'Yealink T22P', :sku => 'YL-SIP-T22P', :description => lorem, :short_description => lorem, :weight => 1.419, :price => 64.99, :cost_price => 56.99, :tax_rate => tax_rate)
|
46
|
+
pro.product_category_ids = cat1.id
|
47
|
+
pro.default_image_file = get_file('t22p.jpg')
|
48
|
+
pro.save!
|
49
|
+
pro.stock_level_adjustments.create(:description => 'Initial Stock', :adjustment => 200)
|
50
|
+
pro.product_attributes.create!(:key => 'Manufacturer', :value => 'Yealink', :position => 1)
|
51
|
+
pro.product_attributes.create!(:key => 'Model', :value => 'T22P', :position => 1)
|
52
|
+
pro.product_attributes.create!(:key => 'Colour', :value => 'Black', :position => 1)
|
53
|
+
pro.product_attributes.create!(:key => 'Lines', :value => '4', :position => 1)
|
54
|
+
pro.product_attributes.create!(:key => 'Colour Screen?', :value => 'No', :position => 1)
|
55
|
+
pro.product_attributes.create!(:key => 'Power over ethernet?', :value => 'Yes', :position => 1)
|
56
|
+
|
57
|
+
|
58
|
+
pro = KktShoppe::Product.new(:name => 'Yealink T26P', :sku => 'YL-SIP-T26P', :description => lorem, :short_description => lorem, :weight => 2.23, :price => 88.99, :cost_price => 78.99, :tax_rate => tax_rate)
|
59
|
+
pro.product_category_ids = cat1.id
|
60
|
+
pro.default_image_file = get_file('t26p.jpg')
|
61
|
+
pro.save!
|
62
|
+
pro.stock_level_adjustments.create(:description => 'Initial Stock', :adjustment => 100)
|
63
|
+
pro.product_attributes.create!(:key => 'Manufacturer', :value => 'Yealink', :position => 1)
|
64
|
+
pro.product_attributes.create!(:key => 'Model', :value => 'T26P', :position => 1)
|
65
|
+
pro.product_attributes.create!(:key => 'Colour', :value => 'Black', :position => 1)
|
66
|
+
pro.product_attributes.create!(:key => 'Lines', :value => '6', :position => 1)
|
67
|
+
pro.product_attributes.create!(:key => 'Colour Screen?', :value => 'No', :position => 1)
|
68
|
+
pro.product_attributes.create!(:key => 'Power over ethernet?', :value => 'Yes', :position => 1)
|
69
|
+
|
70
|
+
pro = KktShoppe::Product.new(:name => 'Yealink T46GN', :sku => 'YL-SIP-T46GN', :description => lorem, :short_description => 'Colourful, sharp, fast & down right sexy. The Yealink T46P will make your scream!', :weight => 2.23, :price => 149.99, :cost_price => 139.99, :tax_rate => tax_rate, :featured => true)
|
71
|
+
pro.product_category_ids = cat1.id
|
72
|
+
pro.default_image_file = get_file('t46gn.jpg')
|
73
|
+
pro.save!
|
74
|
+
pro.stock_level_adjustments.create(:description => 'Initial Stock', :adjustment => 10)
|
75
|
+
pro.product_attributes.create!(:key => 'Manufacturer', :value => 'Yealink', :position => 1)
|
76
|
+
pro.product_attributes.create!(:key => 'Model', :value => 'T46GN', :position => 1)
|
77
|
+
pro.product_attributes.create!(:key => 'Colour', :value => 'Black', :position => 1)
|
78
|
+
pro.product_attributes.create!(:key => 'Lines', :value => '4', :position => 1)
|
79
|
+
pro.product_attributes.create!(:key => 'Colour Screen?', :value => 'Yes', :position => 1)
|
80
|
+
pro.product_attributes.create!(:key => 'Power over ethernet?', :value => 'Yes', :position => 1)
|
81
|
+
|
82
|
+
pro = KktShoppe::Product.new(:name => 'Snom 870', :sku => 'SM-870', :description => lorem, :short_description => 'The perfect & beautiful VoIP phone for the discerning professional desk.', :featured => true)
|
83
|
+
pro.product_category_ids = cat1.id
|
84
|
+
pro.default_image_file = get_file('snom-870-grey.jpg')
|
85
|
+
pro.save!
|
86
|
+
pro.product_attributes.create!(:key => 'Manufacturer', :value => 'Snom', :position => 1)
|
87
|
+
pro.product_attributes.create!(:key => 'Model', :value => '870', :position => 1)
|
88
|
+
pro.product_attributes.create!(:key => 'Colour', :value => 'Grey', :position => 1)
|
89
|
+
pro.product_attributes.create!(:key => 'Lines', :value => '10', :position => 1)
|
90
|
+
pro.product_attributes.create!(:key => 'Colour Screen?', :value => 'Yes', :position => 1)
|
91
|
+
pro.product_attributes.create!(:key => 'Power over ethernet?', :value => 'Yes', :position => 1)
|
92
|
+
|
93
|
+
v1 = pro.variants.create(:name => "White/Grey", :sku => "SM-870-GREY", :price => 230.00, :cost_price => 220, :tax_rate => tax_rate, :weight => 1.35, :default => true)
|
94
|
+
v1.default_image_file = get_file('snom-870-grey.jpg')
|
95
|
+
v1.save!
|
96
|
+
v1.stock_level_adjustments.create(:description => 'Initial Stock', :adjustment => 4)
|
97
|
+
|
98
|
+
|
99
|
+
v2 = pro.variants.create(:name => "Black", :sku => "SM-870-BLK", :price => 230.00, :cost_price => 220, :tax_rate => tax_rate, :weight => 1.35)
|
100
|
+
v2.default_image_file = get_file('snom-870-blk.jpg')
|
101
|
+
v2.save!
|
102
|
+
v2.stock_level_adjustments.create(:description => 'Initial Stock', :adjustment => 2)
|
103
|
+
|
104
|
+
|
105
|
+
pro = KktShoppe::Product.new(:name => 'Yealink Mono Headset', :sku => 'YL-YHS32', :description => lorem, :short_description => 'If you\'re often on the phone, this headset will make your life 100x easier. Guaranteed*.', :weight => 0.890, :price => 34.99, :cost_price => 24.99, :tax_rate => tax_rate, :featured => true)
|
106
|
+
pro.product_category_ids = cat2.id
|
107
|
+
pro.default_image_file = get_file('yhs32.jpg')
|
108
|
+
pro.save!
|
109
|
+
pro.product_attributes.create!(:key => 'Manufacturer', :value => 'Yealink', :position => 1)
|
110
|
+
pro.product_attributes.create!(:key => 'Model', :value => 'YHS32', :position => 1)
|
111
|
+
|
112
|
+
pro = KktShoppe::Product.new(:name => 'Snom Wired Headset (MM2)', :sku => 'SM-MM2', :description => lorem, :short_description => lorem, :weight => 0.780, :price => 38.00, :cost_price => 30, :tax_rate => tax_rate)
|
113
|
+
pro.product_category_ids = cat2.id
|
114
|
+
pro.default_image_file = get_file('snom-mm2.jpg')
|
115
|
+
pro.save!
|
116
|
+
pro.stock_level_adjustments.create(:description => 'Initial Stock', :adjustment => 7)
|
117
|
+
pro.product_attributes.create!(:key => 'Manufacturer', :value => 'Snom', :position => 1)
|
118
|
+
pro.product_attributes.create!(:key => 'Model', :value => 'MM2', :position => 1)
|
119
|
+
|
120
|
+
pro = KktShoppe::Product.new(:name => 'Snom Wired Headset (MM3)', :sku => 'SM-MM3', :description => lorem, :short_description => lorem, :weight => 0.780, :price => 38.00, :cost_price => 30, :tax_rate => tax_rate)
|
121
|
+
pro.product_category_ids = cat2.id
|
122
|
+
pro.default_image_file = get_file('snom-mm2.jpg')
|
123
|
+
pro.save!
|
124
|
+
pro.stock_level_adjustments.create(:description => 'Initial Stock', :adjustment => 5)
|
125
|
+
pro.product_attributes.create!(:key => 'Manufacturer', :value => 'Snom', :position => 1)
|
126
|
+
pro.product_attributes.create!(:key => 'Model', :value => 'MM3', :position => 1)
|
127
|
+
|
128
|
+
pro = KktShoppe::Product.new(:name => 'Yealink W52P', :sku => 'TL-SIP-W52P', :description => lorem, :short_description => 'Wireless SIP phones are hard to come by but this beauty from Yealink is fab.', :weight => 1.280, :price => 99.99, :cost_price => 89.99, :tax_rate => tax_rate, :featured => true)
|
129
|
+
pro.product_category_ids = cat1.id
|
130
|
+
pro.default_image_file = get_file('w52p.jpg')
|
131
|
+
pro.save!
|
132
|
+
pro.stock_level_adjustments.create(:description => 'Initial Stock', :adjustment => 10)
|
133
|
+
pro.product_attributes.create!(:key => 'Manufacturer', :value => 'Snom', :position => 1)
|
134
|
+
pro.product_attributes.create!(:key => 'Model', :value => 'W52P', :position => 1)
|
135
|
+
pro.product_attributes.create!(:key => 'Lines', :value => '3', :position => 1)
|
136
|
+
pro.product_attributes.create!(:key => 'Colour Screen?', :value => 'Yes', :position => 1)
|
137
|
+
pro.product_attributes.create!(:key => 'Power over ethernet?', :value => 'No', :position => 1)
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module KktShoppe
|
2
|
+
module AssociatedCountries
|
3
|
+
|
4
|
+
def self.included(base)
|
5
|
+
base.serialize :country_ids, Array
|
6
|
+
base.before_validation { self.country_ids = self.country_ids.map(&:to_i).select { |i| i > 0} if self.country_ids.is_a?(Array) }
|
7
|
+
end
|
8
|
+
|
9
|
+
def country?(id)
|
10
|
+
id = id.id if id.is_a?(KktShoppe::Country)
|
11
|
+
self.country_ids.is_a?(Array) && self.country_ids.include?(id.to_i)
|
12
|
+
end
|
13
|
+
|
14
|
+
def countries
|
15
|
+
return [] unless self.country_ids.is_a?(Array) && !self.country_ids.empty?
|
16
|
+
KktShoppe::Country.where(:id => self.country_ids)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module KktShoppe
|
2
|
+
module CountryImporter
|
3
|
+
def self.import
|
4
|
+
|
5
|
+
eu_members = ['Austria', 'Belgium', 'Bulgaria', 'Croatia','Cyprus','Czech Republic','Denmark','Estonia','Finland','France','Germany','Greece','Hungary','Ireland','Italy','Latvia','Lithuania','Luxembourg','Malta','Netherlands','Poland','Portugal','Romania','Slovakia','Slovenia','Spain','Sweden','United Kingdom']
|
6
|
+
countries = File.read(File.join(KktShoppe.root, 'db', 'countries.txt')).gsub(/\r/, "\n").split("\n").map { |c| c.split(/\t/) }
|
7
|
+
countries.each do |code2, code3, name, continent, tld, currency|
|
8
|
+
country = Country.new(:name => name, :code2 => code2, :code3 => code3, :continent => continent, :tld => tld.gsub('.', ''), :currency => currency)
|
9
|
+
country.eu_member = true if eu_members.map(&:upcase).include?(name.upcase)
|
10
|
+
country.save
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'kkt_shoppe/navigation_manager'
|
2
|
+
|
3
|
+
# This file defines all the default navigation managers used in KktShoppe. Of course,
|
4
|
+
# modules can make changes to these by removing them or adding their own. This
|
5
|
+
# file is loaded on application initialization so if you make changes, you'll need
|
6
|
+
# to restart the webserver.
|
7
|
+
|
8
|
+
#
|
9
|
+
# This is the default navigation manager for the admin interface.
|
10
|
+
#
|
11
|
+
KktShoppe::NavigationManager.build(:admin_primary) do
|
12
|
+
add_item :customers
|
13
|
+
add_item :orders
|
14
|
+
add_item :products
|
15
|
+
add_item :product_categories
|
16
|
+
add_item :delivery_services
|
17
|
+
add_item :tax_rates
|
18
|
+
add_item :users
|
19
|
+
add_item :countries
|
20
|
+
add_item :settings
|
21
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module KktShoppe
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
isolate_namespace KktShoppe
|
4
|
+
|
5
|
+
if KktShoppe.respond_to?(:root)
|
6
|
+
config.autoload_paths << File.join(KktShoppe.root, 'lib')
|
7
|
+
config.assets.precompile += ['kkt_shoppe/sub.css', 'kkt_shoppe/printable.css']
|
8
|
+
end
|
9
|
+
|
10
|
+
# We don't want any automatic generators in the engine.
|
11
|
+
config.generators do |g|
|
12
|
+
g.orm :active_record
|
13
|
+
g.test_framework false
|
14
|
+
g.stylesheets false
|
15
|
+
g.javascripts false
|
16
|
+
g.helper false
|
17
|
+
end
|
18
|
+
|
19
|
+
config.to_prepare do
|
20
|
+
Dir.glob(Rails.root + "app/decorators/**/*_decorator*.rb").each do |c|
|
21
|
+
require_dependency(c)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
initializer 'kkt_shoppe.initialize' do |app|
|
26
|
+
# Add the default settings
|
27
|
+
KktShoppe.add_settings_group :system_settings, [:store_name, :email_address, :currency_unit, :tax_name, :demo_mode]
|
28
|
+
|
29
|
+
# Add middleware
|
30
|
+
app.config.middleware.use KktShoppe::SettingsLoader
|
31
|
+
|
32
|
+
# Load our migrations into the application's db/migrate path
|
33
|
+
unless app.root.to_s.match root.to_s
|
34
|
+
config.paths["db/migrate"].expanded.each do |expanded_path|
|
35
|
+
app.config.paths["db/migrate"] << expanded_path
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Load view helpers for the base application
|
40
|
+
ActiveSupport.on_load(:action_view) do
|
41
|
+
require 'kkt_shoppe/view_helpers'
|
42
|
+
ActionView::Base.send :include, KktShoppe::ViewHelpers
|
43
|
+
end
|
44
|
+
|
45
|
+
# Load default navigation
|
46
|
+
require 'kkt_shoppe/default_navigation'
|
47
|
+
end
|
48
|
+
|
49
|
+
generators do
|
50
|
+
require 'kkt_shoppe/setup_generator'
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module KktShoppe
|
2
|
+
class Error < StandardError
|
3
|
+
|
4
|
+
def initialize(options = {})
|
5
|
+
if options.is_a?(String)
|
6
|
+
@options = {:message => options}
|
7
|
+
else
|
8
|
+
@options = options
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def message
|
13
|
+
@options[:message]
|
14
|
+
end
|
15
|
+
|
16
|
+
def options
|
17
|
+
@options
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|