spree_sample 4.10.1 → 5.0.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/db/samples/option_types.rb +2 -22
- data/db/samples/option_values.rb +21 -40
- data/db/samples/orders.rb +15 -20
- data/db/samples/payment_methods.rb +0 -2
- data/db/samples/posts.rb +8 -0
- data/db/samples/product_properties.rb +18 -93
- data/db/samples/products.rb +28 -27
- data/db/samples/promotions.rb +5 -5
- data/db/samples/reimbursement_types.rb +11 -0
- data/db/samples/return_authorization_reasons.rb +9 -3
- data/db/samples/stock.rb +2 -15
- data/db/samples/taxons.rb +0 -2
- data/db/samples/variants.csv +25 -25
- data/db/samples/variants.rb +19 -27
- data/db/samples.rb +1 -0
- data/lib/spree_sample.rb +3 -12
- metadata +8 -51
- data/Gemfile +0 -5
- data/db/samples/cms_feature_pages.rb +0 -34
- data/db/samples/cms_homepages.rb +0 -34
- data/db/samples/cms_sections.rb +0 -246
- data/db/samples/cms_standard_pages.rb +0 -134
- data/db/samples/data_feeds.rb +0 -6
- data/db/samples/images/apache_baseball.png +0 -0
- data/db/samples/images/ror_bag.jpeg +0 -0
- data/db/samples/images/ror_baseball.jpeg +0 -0
- data/db/samples/images/ror_baseball_back.jpeg +0 -0
- data/db/samples/images/ror_baseball_jersey_back_blue.png +0 -0
- data/db/samples/images/ror_baseball_jersey_back_green.png +0 -0
- data/db/samples/images/ror_baseball_jersey_back_red.png +0 -0
- data/db/samples/images/ror_baseball_jersey_blue.png +0 -0
- data/db/samples/images/ror_baseball_jersey_green.png +0 -0
- data/db/samples/images/ror_baseball_jersey_red.png +0 -0
- data/db/samples/images/ror_jr_spaghetti.jpeg +0 -0
- data/db/samples/images/ror_mug.jpeg +0 -0
- data/db/samples/images/ror_mug_back.jpeg +0 -0
- data/db/samples/images/ror_ringer.jpeg +0 -0
- data/db/samples/images/ror_ringer_back.jpeg +0 -0
- data/db/samples/images/ror_stein.jpeg +0 -0
- data/db/samples/images/ror_stein_back.jpeg +0 -0
- data/db/samples/images/ror_tote.jpeg +0 -0
- data/db/samples/images/ror_tote_back.jpeg +0 -0
- data/db/samples/images/ruby_baseball.png +0 -0
- data/db/samples/images/spree_bag.jpeg +0 -0
- data/db/samples/images/spree_jersey.jpeg +0 -0
- data/db/samples/images/spree_jersey_back.jpeg +0 -0
- data/db/samples/images/spree_mug.jpeg +0 -0
- data/db/samples/images/spree_mug_back.jpeg +0 -0
- data/db/samples/images/spree_ringer_t.jpeg +0 -0
- data/db/samples/images/spree_ringer_t_back.jpeg +0 -0
- data/db/samples/images/spree_spaghetti.jpeg +0 -0
- data/db/samples/images/spree_stein.jpeg +0 -0
- data/db/samples/images/spree_stein_back.jpeg +0 -0
- data/db/samples/images/spree_tote_back.jpeg +0 -0
- data/db/samples/images/spree_tote_front.jpeg +0 -0
- data/db/samples/menu_items.rb +0 -413
- data/db/samples/menus.rb +0 -17
- data/db/samples/properties.rb +0 -22
- data/db/samples/prototypes.rb +0 -24
- data/db/samples/stores.rb +0 -52
- data/db/samples/taxonomies.rb +0 -16
- data/spree_sample.gemspec +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf2d9be25ee6461d4a81db19625ba21d2799a13b29fecf0642903547a42a77cd
|
4
|
+
data.tar.gz: d62f5e72fe797e56a814c7d174ef06c97db96a3bdde4660b708049ffb78a98aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f99037adf63db6589d4dc35e422edca810fc94e6e10c5029be12e2d79c76c2fd2016a47651d90a3d1d8cac1d68dd3fd9de4a5dc2f9da2a3788586446a6b6358f
|
7
|
+
data.tar.gz: 3858c2ed354cd482ca7ba7685a7a556a41c96419cd978f4eaddd4e6b8e0de9c3b5b55cb8de660f005f3a68ac03f13e8bf933521cffb238f8edd3d09539aa4476
|
data/db/samples/option_types.rb
CHANGED
@@ -1,23 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
name: 'color',
|
4
|
-
presentation: 'Color',
|
5
|
-
position: 1
|
6
|
-
},
|
7
|
-
{
|
8
|
-
name: 'length',
|
9
|
-
presentation: 'Length',
|
10
|
-
position: 2
|
11
|
-
},
|
12
|
-
{
|
13
|
-
name: 'size',
|
14
|
-
presentation: 'Size',
|
15
|
-
position: 3
|
16
|
-
},
|
17
|
-
]
|
18
|
-
|
19
|
-
option_types_attributes.each do |attrs|
|
20
|
-
unless Spree::OptionType.where(attrs).exists?
|
21
|
-
Spree::OptionType.create!(attrs)
|
22
|
-
end
|
1
|
+
['color', 'size'].each do |name|
|
2
|
+
Spree::OptionType.find_or_create_by!(name: name, presentation: name.capitalize)
|
23
3
|
end
|
data/db/samples/option_values.rb
CHANGED
@@ -1,55 +1,36 @@
|
|
1
1
|
Spree::Sample.load_sample('option_types')
|
2
2
|
|
3
3
|
color_option_type = Spree::OptionType.find_by!(name: 'color')
|
4
|
-
length_option_type = Spree::OptionType.find_by!(name: 'length')
|
5
4
|
size_option_type = Spree::OptionType.find_by!(name: 'size')
|
6
5
|
|
7
6
|
colors = {
|
8
|
-
white: '
|
9
|
-
purple: '
|
10
|
-
red: '
|
11
|
-
black: '
|
12
|
-
brown: '
|
13
|
-
green: '
|
14
|
-
grey: '
|
15
|
-
orange: '
|
16
|
-
burgundy: '
|
17
|
-
beige: '
|
18
|
-
mint: '
|
19
|
-
blue: '
|
20
|
-
|
21
|
-
khaki: '
|
22
|
-
yellow: '
|
23
|
-
|
24
|
-
pink: '
|
25
|
-
lila: '
|
26
|
-
ecru: '
|
7
|
+
white: 'White',
|
8
|
+
purple: 'Purple',
|
9
|
+
red: 'Red',
|
10
|
+
black: 'Black',
|
11
|
+
brown: 'Brown',
|
12
|
+
green: 'Green',
|
13
|
+
grey: 'Grey',
|
14
|
+
orange: 'Orange',
|
15
|
+
burgundy: 'Burgundy',
|
16
|
+
beige: 'Beige',
|
17
|
+
mint: 'Mint',
|
18
|
+
blue: 'Blue',
|
19
|
+
'dark-blue': 'Dark Blue',
|
20
|
+
khaki: 'Khaki',
|
21
|
+
yellow: 'Yellow',
|
22
|
+
'light-blue': 'Light Blue',
|
23
|
+
pink: 'Pink',
|
24
|
+
lila: 'Lila',
|
25
|
+
ecru: 'Ecru'
|
27
26
|
}
|
28
27
|
|
29
|
-
lengths = { mini: 'Mini', midi: 'Midi', maxi: 'Maxi' }
|
30
|
-
|
31
28
|
sizes = { xs: 'XS', s: 'S', m: 'M', l: 'L', xl: 'XL' }
|
32
29
|
|
33
30
|
colors.each_with_index do |color, index|
|
34
|
-
color_option_type.option_values.find_or_create_by!(
|
35
|
-
name: color.first,
|
36
|
-
presentation: color.last,
|
37
|
-
position: index + 1
|
38
|
-
)
|
39
|
-
end
|
40
|
-
|
41
|
-
lengths.each_with_index do |length, index|
|
42
|
-
length_option_type.option_values.find_or_create_by!(
|
43
|
-
name: length.first,
|
44
|
-
presentation: length.last,
|
45
|
-
position: index + 1
|
46
|
-
)
|
31
|
+
color_option_type.option_values.find_or_create_by!(name: color.first, presentation: color.last)
|
47
32
|
end
|
48
33
|
|
49
34
|
sizes.each_with_index do |size, index|
|
50
|
-
size_option_type.option_values.find_or_create_by!(
|
51
|
-
name: size.first,
|
52
|
-
presentation: size.last,
|
53
|
-
position: index + 1
|
54
|
-
)
|
35
|
+
size_option_type.option_values.find_or_create_by!(name: size.first, presentation: size.last)
|
55
36
|
end
|
data/db/samples/orders.rb
CHANGED
@@ -1,55 +1,50 @@
|
|
1
1
|
Spree::Sample.load_sample('addresses')
|
2
2
|
Spree::Sample.load_sample('products')
|
3
3
|
|
4
|
+
store = Spree::Store.default
|
4
5
|
product_1 = Spree::Product.find_by!(name: 'Denim Shirt')
|
5
6
|
product_2 = Spree::Product.find_by!(name: 'Checked Shirt')
|
6
7
|
|
7
8
|
orders = []
|
8
|
-
orders <<
|
9
|
+
orders << store.orders.where(
|
10
|
+
store: store,
|
9
11
|
number: 'R123456789',
|
10
12
|
email: 'spree@example.com',
|
11
13
|
currency: 'USD'
|
12
14
|
).first_or_create! do |order|
|
13
|
-
order.item_total = product_1.
|
14
|
-
order.adjustment_total = product_1.
|
15
|
-
order.total = product_1.
|
15
|
+
order.item_total = product_1.default_variant.amount_in(order.currency)
|
16
|
+
order.adjustment_total = product_1.default_variant.amount_in(order.currency)
|
17
|
+
order.total = product_1.default_variant.amount_in(order.currency) * 2
|
16
18
|
end
|
17
19
|
|
18
|
-
orders <<
|
20
|
+
orders << store.orders.where(
|
19
21
|
number: 'R987654321',
|
20
22
|
email: 'spree@example.com',
|
21
23
|
currency: 'USD'
|
22
24
|
).first_or_create! do |order|
|
23
|
-
order.item_total = product_2.
|
24
|
-
order.adjustment_total = product_2.
|
25
|
-
order.total = product_2.
|
25
|
+
order.item_total = product_2.default_variant.amount_in(order.currency)
|
26
|
+
order.adjustment_total = product_2.default_variant.amount_in(order.currency)
|
27
|
+
order.total = product_2.default_variant.amount_in(order.currency) * 2
|
26
28
|
order.shipping_address = Spree::Address.first
|
27
29
|
order.billing_address = Spree::Address.last
|
28
30
|
end
|
29
31
|
|
30
32
|
unless orders[0].line_items.any?
|
31
33
|
orders[0].line_items.new(
|
32
|
-
variant: product_1.
|
34
|
+
variant: product_1.default_variant,
|
33
35
|
quantity: 1,
|
34
|
-
price: product_1.
|
36
|
+
price: product_1.default_variant.amount_in(orders[0].currency)
|
35
37
|
).save!
|
36
38
|
end
|
37
39
|
|
38
40
|
unless orders[1].line_items.any?
|
39
41
|
orders[1].line_items.new(
|
40
|
-
variant: product_2.
|
42
|
+
variant: product_2.default_variant,
|
41
43
|
quantity: 1,
|
42
|
-
price: product_1.
|
44
|
+
price: product_1.default_variant.amount_in(orders[1].currency)
|
43
45
|
).save!
|
44
46
|
end
|
45
47
|
|
46
48
|
orders.each(&:create_proposed_shipments)
|
47
49
|
|
48
|
-
|
49
|
-
|
50
|
-
orders.each do |order|
|
51
|
-
order.state = 'complete'
|
52
|
-
order.store = store
|
53
|
-
order.completed_at = Time.current - 1.day
|
54
|
-
order.save!
|
55
|
-
end
|
50
|
+
Spree::Order.where(id: orders.map(&:id)).update_all(state: :complete, completed_at: Time.current - 1.day)
|
data/db/samples/posts.rb
ADDED
@@ -1,102 +1,27 @@
|
|
1
|
-
Spree::Sample.load_sample('taxons')
|
2
1
|
Spree::Sample.load_sample('products')
|
3
2
|
|
4
|
-
|
5
|
-
{
|
6
|
-
'manufacturer' => 'Wilson',
|
7
|
-
'brand' => 'Wannabe Sports',
|
8
|
-
'model' => 'JK1002',
|
9
|
-
'shirt_type' => 'Baseball Jersey',
|
10
|
-
'sleeve_type' => 'Long',
|
11
|
-
'material' => '100% cotton',
|
12
|
-
'fit' => 'Loose',
|
13
|
-
'gender' => 'Men\'s'
|
14
|
-
},
|
15
|
-
{
|
16
|
-
'manufacturer' => 'Jerseys',
|
17
|
-
'brand' => 'Conditioned',
|
18
|
-
'model' => 'TL9002',
|
19
|
-
'shirt_type' => 'Ringer T',
|
20
|
-
'sleeve_type' => 'Short',
|
21
|
-
'material' => '100% Vellum',
|
22
|
-
'fit' => 'Loose',
|
23
|
-
'gender' => 'Men\'s'
|
24
|
-
},
|
25
|
-
{
|
26
|
-
'manufacturer' => 'Wilson',
|
27
|
-
'brand' => 'Wannabe Sports',
|
28
|
-
'model' => 'JK1002',
|
29
|
-
'shirt_type' => 'Baseball Jersey',
|
30
|
-
'sleeve_type' => 'Long',
|
31
|
-
'material' => '100% cotton',
|
32
|
-
'fit' => 'Loose',
|
33
|
-
'gender' => 'Men\'s'
|
34
|
-
},
|
35
|
-
{
|
36
|
-
'manufacturer' => 'Jerseys',
|
37
|
-
'brand' => 'Conditioned',
|
38
|
-
'model' => 'TL9002',
|
39
|
-
'shirt_type' => 'Ringer T',
|
40
|
-
'sleeve_type' => 'Short',
|
41
|
-
'material' => '100% Vellum',
|
42
|
-
'fit' => 'Loose',
|
43
|
-
'gender' => 'Men\'s'
|
44
|
-
}
|
45
|
-
]
|
46
|
-
Spree::Taxon.find_by!(name: 'Men').children.find_by!(name: 'T-shirts').products.each do |product|
|
47
|
-
men_tshirts_properties.sample.each do |prop_name, prop_value|
|
48
|
-
product.set_property(prop_name, prop_value, prop_name.gsub('_', ' ').capitalize)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
women_tshirts_properties = [
|
53
|
-
{
|
54
|
-
'manufacturer' => 'Jerseys',
|
55
|
-
'brand' => 'Resiliance',
|
56
|
-
'model' => 'TL174',
|
57
|
-
'shirt_type' => 'Jr. Spaghetti T',
|
58
|
-
'sleeve_type' => 'None',
|
59
|
-
'material' => '90% Cotton, 10% Nylon',
|
60
|
-
'fit' => 'Form',
|
61
|
-
'gender' => 'Women\'s'
|
62
|
-
},
|
63
|
-
{
|
64
|
-
'manufacturer' => 'Jerseys',
|
65
|
-
'brand' => 'Resiliance',
|
66
|
-
'model' => 'TL174',
|
67
|
-
'shirt_type' => 'Jr. Spaghetti T',
|
68
|
-
'sleeve_type' => 'None',
|
69
|
-
'material' => '90% Cotton, 10% Nylon',
|
70
|
-
'fit' => 'Form',
|
71
|
-
'gender' => 'Women\'s'
|
72
|
-
}
|
73
|
-
]
|
74
|
-
|
75
|
-
Spree::Taxon.find_by!(name: 'Women').children.find_by!(name: 'Tops and T-shirts').products.each do |product|
|
76
|
-
women_tshirts_properties.sample.each do |prop_name, prop_value|
|
77
|
-
product.set_property(prop_name, prop_value, prop_name.gsub('_', ' ').capitalize)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
properties = {
|
3
|
+
property_values = {
|
82
4
|
manufacturers: %w[Wilson Jerseys Wannabe Resiliance Conditioned],
|
83
5
|
brands: %w[Alpha Beta Gamma Delta Theta Epsilon Zeta],
|
84
6
|
materials: ['90% Cotton 10% Elastan', '50% Cotton 50% Elastan', '10% Cotton 90% Elastan'],
|
85
7
|
fits: %w[Form Lose]
|
86
8
|
}
|
87
9
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
10
|
+
properties = Spree::Property.insert_all([
|
11
|
+
{ name: 'manufacturer', presentation: 'Manufacturer' },
|
12
|
+
{ name: 'brand', presentation: 'Brand' },
|
13
|
+
{ name: 'material', presentation: 'Material' },
|
14
|
+
{ name: 'fit', presentation: 'Fit' },
|
15
|
+
])
|
16
|
+
|
17
|
+
properties_ids = properties.rows.flatten
|
18
|
+
properties_to_insert = Spree::Product.all.ids.flat_map do |product_id|
|
19
|
+
[
|
20
|
+
{ product_id: product_id, property_id: properties_ids.first, value: property_values[:manufacturers].sample },
|
21
|
+
{ product_id: product_id, property_id: properties_ids.second, value: property_values[:brands].sample },
|
22
|
+
{ product_id: product_id, property_id: properties_ids.third, value: property_values[:materials].sample },
|
23
|
+
{ product_id: product_id, property_id: properties_ids.fourth, value: property_values[:fits].sample },
|
24
|
+
]
|
102
25
|
end
|
26
|
+
|
27
|
+
Spree::ProductProperty.insert_all(properties_to_insert)
|
data/db/samples/products.rb
CHANGED
@@ -3,47 +3,48 @@ require 'csv'
|
|
3
3
|
Spree::Sample.load_sample('tax_categories')
|
4
4
|
Spree::Sample.load_sample('option_types')
|
5
5
|
Spree::Sample.load_sample('taxons')
|
6
|
-
Spree::Sample.load_sample('stores')
|
7
6
|
|
8
7
|
default_shipping_category = Spree::ShippingCategory.find_or_create_by!(name: 'Default')
|
9
8
|
clothing_tax_category = Spree::TaxCategory.find_or_create_by!(name: 'Clothing')
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
size = Spree::OptionType.find_by!(name: 'size')
|
10
|
+
color_option_type = Spree::OptionType.find_by!(name: 'color')
|
11
|
+
size_option_type = Spree::OptionType.find_by!(name: 'size')
|
14
12
|
|
15
|
-
PRODUCTS = CSV.read(File.join(__dir__, 'variants.csv'))
|
16
|
-
[parent_name, taxon_name, product_name]
|
17
|
-
end.uniq
|
13
|
+
PRODUCTS = CSV.read(File.join(__dir__, 'variants.csv'))
|
18
14
|
|
19
|
-
|
20
|
-
parent = Spree::Taxon.find_by!(name: parent_name)
|
21
|
-
taxon = parent.children.find_by!(name: taxon_name)
|
22
|
-
next if Spree::Product.where(name: product_name.titleize).any?
|
15
|
+
taxons = Spree::Taxon.includes(:children).all
|
23
16
|
|
24
|
-
|
17
|
+
PRODUCTS.each do |(parent_name, taxon_name, product_name, color_name)|
|
18
|
+
parent = taxons.find { |taxon| taxon.name == parent_name }
|
19
|
+
taxon = parent.children.find { |child| child.name == taxon_name }
|
20
|
+
|
21
|
+
sleep(0.1) # to avoid DB lock
|
22
|
+
|
23
|
+
product = Spree::Product.find_or_initialize_by(name: product_name.titleize) do |product|
|
25
24
|
product.price = rand(10...100) + 0.99
|
26
25
|
product.description = FFaker::Lorem.paragraph
|
27
26
|
product.available_on = Time.zone.now
|
28
|
-
product.make_active_at = Time.zone.now
|
29
27
|
product.status = 'active'
|
30
|
-
product.option_types =
|
31
|
-
if parent_name == 'Women' && %w[Dresses Skirts].include?(taxon_name)
|
32
|
-
[color, length, size]
|
33
|
-
else
|
34
|
-
[color, size]
|
35
|
-
end
|
28
|
+
product.option_types = [color_option_type, size_option_type]
|
36
29
|
product.shipping_category = default_shipping_category
|
37
30
|
product.tax_category = clothing_tax_category
|
38
|
-
product.
|
39
|
-
product.taxons << parent unless product.taxons.include?(parent)
|
40
|
-
product.taxons << taxon unless product.taxons.include?(taxon)
|
41
|
-
product.stores = Spree::Store.all
|
31
|
+
product.taxons = [taxon]
|
42
32
|
end
|
33
|
+
product.save!
|
43
34
|
end
|
44
35
|
|
45
|
-
Spree::
|
46
|
-
|
47
|
-
|
48
|
-
|
36
|
+
store_ids = Spree::Store.ids
|
37
|
+
product_ids = Spree::Product.ids
|
38
|
+
|
39
|
+
store_ids.each do |store_id|
|
40
|
+
if ActiveRecord::Base.connection.adapter_name == 'Mysql2'
|
41
|
+
Spree::StoreProduct.upsert_all(
|
42
|
+
product_ids.map { |product_id| { store_id: store_id, product_id: product_id } }
|
43
|
+
)
|
44
|
+
else
|
45
|
+
Spree::StoreProduct.upsert_all(
|
46
|
+
product_ids.map { |product_id| { store_id: store_id, product_id: product_id } },
|
47
|
+
unique_by: [:store_id, :product_id]
|
48
|
+
)
|
49
|
+
end
|
49
50
|
end
|
data/db/samples/promotions.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
Spree::Sample.load_sample('stores')
|
2
1
|
Spree::Sample.load_sample('option_values')
|
3
2
|
Spree::Sample.load_sample('products')
|
4
3
|
|
@@ -12,15 +11,16 @@ promotion = Spree::Promotion.where(
|
|
12
11
|
usage_limit: nil,
|
13
12
|
path: nil,
|
14
13
|
match_policy: 'any',
|
15
|
-
description: ''
|
16
|
-
|
14
|
+
description: '',
|
15
|
+
code: 'FREESHIP'
|
16
|
+
).first_or_create! do |promo|
|
17
17
|
promo.stores = Spree::Store.all
|
18
18
|
end
|
19
19
|
|
20
20
|
Spree::PromotionRule.where(
|
21
|
-
|
21
|
+
promotion: promotion,
|
22
22
|
type: 'Spree::Promotion::Rules::OptionValue',
|
23
23
|
preferences: { match_policy: 'any', eligible_values: { product.id.to_s => eligible_values } }
|
24
24
|
).first_or_create!
|
25
25
|
|
26
|
-
Spree::Promotion::Actions::FreeShipping.where(
|
26
|
+
Spree::Promotion::Actions::FreeShipping.where(promotion: promotion).first_or_create!
|
@@ -0,0 +1,11 @@
|
|
1
|
+
reasons = [
|
2
|
+
['Exchange', 'Spree::ReimbursementType::Exchange'],
|
3
|
+
['Original payment', 'Spree::ReimbursementType::OriginalPayment'],
|
4
|
+
['Store credit', 'Spree::ReimbursementType::StoreCredit'],
|
5
|
+
].map do |name, kind|
|
6
|
+
{ name: name, type: kind }
|
7
|
+
end
|
8
|
+
|
9
|
+
reasons.each do |reason|
|
10
|
+
Spree::ReimbursementType.find_or_create_by!(name: reason[:name], type: reason[:type])
|
11
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
[
|
1
|
+
reasons = [
|
2
2
|
'Better price available',
|
3
3
|
'Missed estimated delivery date',
|
4
4
|
'Missing parts or accessories',
|
@@ -8,6 +8,12 @@
|
|
8
8
|
'No longer needed/wanted',
|
9
9
|
'Accidental order',
|
10
10
|
'Unauthorized purchase',
|
11
|
-
].
|
12
|
-
|
11
|
+
].map do |name|
|
12
|
+
{name: name}
|
13
|
+
end
|
14
|
+
|
15
|
+
if ActiveRecord::Base.connection.adapter_name == 'Mysql2'
|
16
|
+
Spree::ReturnAuthorizationReason.insert_all(reasons)
|
17
|
+
else
|
18
|
+
Spree::ReturnAuthorizationReason.upsert_all(reasons, unique_by: :name)
|
13
19
|
end
|
data/db/samples/stock.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Spree::Sample.load_sample('variants')
|
2
2
|
|
3
3
|
country = Spree::Country.find_by(iso: 'US')
|
4
|
-
location = Spree::StockLocation.find_or_create_by!(name:
|
4
|
+
location = Spree::StockLocation.find_or_create_by!(name: Spree.t(:default_stock_location_name), propagate_all_variants: false)
|
5
5
|
location.update(
|
6
6
|
address1: 'Example Street',
|
7
7
|
city: 'City',
|
@@ -12,17 +12,4 @@ location.update(
|
|
12
12
|
)
|
13
13
|
|
14
14
|
Spree::StockLocations::StockItems::Create.call(stock_location: location)
|
15
|
-
|
16
|
-
product_1 = Spree::Product.find_by!(name: 'Denim Shirt')
|
17
|
-
product_2 = Spree::Product.find_by!(name: 'Checked Shirt')
|
18
|
-
|
19
|
-
location.stock_item_or_create(product_1.master).update(count_on_hand: 1)
|
20
|
-
location.stock_item_or_create(product_2.master).update(count_on_hand: 1)
|
21
|
-
|
22
|
-
Spree::Variant.all.each do |variant|
|
23
|
-
next if variant.is_master? && variant.product.has_variants?
|
24
|
-
|
25
|
-
variant.stock_items.each do |stock_item|
|
26
|
-
Spree::StockMovement.create(quantity: rand(20..50), stock_item: stock_item)
|
27
|
-
end
|
28
|
-
end
|
15
|
+
Spree::StockItem.update_all(backorderable: true, count_on_hand: 100)
|
data/db/samples/taxons.rb
CHANGED
data/db/samples/variants.csv
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
Men,Shirts,denim shirt,blue
|
2
|
-
Men,Shirts,denim shirt,
|
2
|
+
Men,Shirts,denim shirt,light-blue
|
3
3
|
Men,Shirts,checked shirt,red
|
4
|
-
Men,Shirts,covered placket shirt,
|
4
|
+
Men,Shirts,covered placket shirt,dark-blue
|
5
5
|
Men,Shirts,covered placket shirt,white
|
6
|
-
Men,Shirts,slim fit shirt,
|
7
|
-
Men,Shirts,slim fit shirt,
|
6
|
+
Men,Shirts,slim fit shirt,dark-blue
|
7
|
+
Men,Shirts,slim fit shirt,light-blue
|
8
8
|
Men,Shirts,slim fit shirt,burgundy
|
9
9
|
Men,Shirts,short sleeve shirt,burgundy
|
10
10
|
Men,Shirts,printed short sleeve shirt,brown
|
11
11
|
Men,Shirts,regular shirt,blue
|
12
12
|
Men,Shirts,checked slim fit shirt,black
|
13
13
|
Men,Shirts,dotted shirt,white
|
14
|
-
Men,Shirts,linen shirt,
|
14
|
+
Men,Shirts,linen shirt,light-blue
|
15
15
|
Men,Shirts,linen shirt,pink
|
16
|
-
Men,Shirts,regular shirt with rolled up sleeves,
|
17
|
-
Men,T-shirts,polo t-shirt,
|
16
|
+
Men,Shirts,regular shirt with rolled up sleeves,light-blue
|
17
|
+
Men,T-shirts,polo t-shirt,light-blue
|
18
18
|
Men,T-shirts,polo t-shirt,pink
|
19
19
|
Men,T-shirts,polo t-shirt,red
|
20
20
|
Men,T-shirts,long sleeve t-shirt,grey
|
@@ -33,20 +33,20 @@ Men,Sweaters,stripped jumper,brown
|
|
33
33
|
Men,Sweaters,long sleeve jumper with pocket,ecru
|
34
34
|
Men,Sweaters,jumper,grey
|
35
35
|
Men,Sweaters,long sleeve sweatshirt,mint
|
36
|
-
Men,Sweaters,long sleeve sweatshirt,
|
36
|
+
Men,Sweaters,long sleeve sweatshirt,light-blue
|
37
37
|
Men,Sweaters,long sleeve sweatshirt,pink
|
38
38
|
Men,Sweaters,long sleeve sweatshirt,orange
|
39
39
|
Men,Sweaters,hoodie,grey
|
40
40
|
Men,Sweaters,zipped high neck sweater,green
|
41
|
-
Men,Sweaters,long sleeve jumper,
|
41
|
+
Men,Sweaters,long sleeve jumper,dark-blue
|
42
42
|
Men,Sweaters,long sleeve jumper,beige
|
43
43
|
Men,Jackets and Coats,suede biker jacket,brown
|
44
44
|
Men,Jackets and Coats,hooded jacket,beige
|
45
45
|
Men,Jackets and Coats,anorak with hood,yellow
|
46
46
|
Men,Jackets and Coats,anorak with hood,white
|
47
|
-
Men,Jackets and Coats,denim jacket,
|
47
|
+
Men,Jackets and Coats,denim jacket,light-blue
|
48
48
|
Men,Jackets and Coats,wool-blend short coat,brown
|
49
|
-
Men,Jackets and Coats,down jacket with hood,
|
49
|
+
Men,Jackets and Coats,down jacket with hood,dark-blue
|
50
50
|
Men,Jackets and Coats,down jacket with hood,blue
|
51
51
|
Men,Jackets and Coats,down jacket with hood,khaki
|
52
52
|
Men,Jackets and Coats,down jacket with hood,yellow
|
@@ -57,16 +57,16 @@ Women,Skirts,midi skirt with bottoms,green
|
|
57
57
|
Women,Skirts,midi skirt with bottoms,blue
|
58
58
|
Women,Skirts,midi skirt with bottoms,grey
|
59
59
|
Women,Skirts,fitted skirt,orange
|
60
|
-
Women,Skirts,a-line suede skirt,
|
60
|
+
Women,Skirts,a-line suede skirt,dark-blue
|
61
61
|
Women,Skirts,a-line suede skirt,purple
|
62
62
|
Women,Skirts,leather skirt with lacing,black
|
63
63
|
Women,Skirts,flared skirt,orange
|
64
64
|
Women,Skirts,skater skirt,brown
|
65
65
|
Women,Skirts,skater short skirt,white
|
66
|
-
Women,Skirts,floral flared skirt,
|
66
|
+
Women,Skirts,floral flared skirt,light-blue
|
67
67
|
Women,Skirts,floral flared skirt,black
|
68
68
|
Women,Skirts,pleated skirt 2,green
|
69
|
-
Women,Skirts,pleated skirt 2,
|
69
|
+
Women,Skirts,pleated skirt 2,light-blue
|
70
70
|
Women,Skirts,pleated skirt 2,pink
|
71
71
|
Women,Skirts,pleated skirt 2,red
|
72
72
|
Women,Skirts,pleated skirt 2,black
|
@@ -82,16 +82,16 @@ Women,Dresses,elegant flared dress,orange
|
|
82
82
|
Women,Dresses,long sleeve knitted dress,grey
|
83
83
|
Women,Dresses,long sleeve knitted dress,beige
|
84
84
|
Women,Dresses,long sleeve knitted dress,black
|
85
|
-
Women,Dresses,striped shirt dress,
|
85
|
+
Women,Dresses,striped shirt dress,light-blue
|
86
86
|
Women,Dresses,striped shirt dress,grey
|
87
|
-
Women,Dresses,printed dress,
|
87
|
+
Women,Dresses,printed dress,light-blue
|
88
88
|
Women,Dresses,printed dress,pink
|
89
|
-
Women,Dresses,printed slit-sleeves dress,
|
89
|
+
Women,Dresses,printed slit-sleeves dress,light-blue
|
90
90
|
Women,Dresses,printed slit-sleeves dress,grey
|
91
91
|
Women,Dresses,printed slit-sleeves dress,black
|
92
92
|
Women,Dresses,dress with belt,red
|
93
93
|
Women,Dresses,dress with belt,burgundy
|
94
|
-
Women,Dresses,v-neck floral dress,
|
94
|
+
Women,Dresses,v-neck floral dress,light-blue
|
95
95
|
Women,Dresses,v-neck floral dress,grey
|
96
96
|
Women,Dresses,v-neck floral dress,black
|
97
97
|
Women,Dresses,flounced dress,beige
|
@@ -100,11 +100,11 @@ Women,Shirts and Blouses,semi-sheer shirt with floral cuffs,brown
|
|
100
100
|
Women,Shirts and Blouses,semi-sheer shirt with floral cuffs,white
|
101
101
|
Women,Shirts and Blouses,striped shirt,blue
|
102
102
|
Women,Shirts and Blouses,striped shirt,red
|
103
|
-
Women,Shirts and Blouses,v-neck wide shirt,
|
103
|
+
Women,Shirts and Blouses,v-neck wide shirt,dark-blue
|
104
104
|
Women,Shirts and Blouses,v-neck wide shirt,white
|
105
105
|
Women,Shirts and Blouses,printed wrapped blouse,white
|
106
106
|
Women,Shirts and Blouses,pleated sleeve v-neck shirt,orange
|
107
|
-
Women,Shirts and Blouses,cotton shirt,
|
107
|
+
Women,Shirts and Blouses,cotton shirt,light-blue
|
108
108
|
Women,Shirts and Blouses,blouse with wide flounced sleeve,pink
|
109
109
|
Women,Shirts and Blouses,elegant blouse with chocker,mint
|
110
110
|
Women,Shirts and Blouses,elegant blouse with chocker,pink
|
@@ -150,13 +150,13 @@ Women,Tops and T-shirts,basic t-shirt,orange
|
|
150
150
|
Women,Jackets and Coats,coat with pockets,pink
|
151
151
|
Women,Jackets and Coats,coat with pockets,burgundy
|
152
152
|
Women,Jackets and Coats,coat with pockets,black
|
153
|
-
Women,Jackets and Coats,long wool-blend coat with belt,
|
153
|
+
Women,Jackets and Coats,long wool-blend coat with belt,dark-blue
|
154
154
|
Women,Jackets and Coats,long wool-blend coat with belt,beige
|
155
155
|
Women,Jackets and Coats,asymmetric coat,white
|
156
156
|
Women,Jackets and Coats,long coat with belt,beige
|
157
157
|
Women,Jackets and Coats,down jacket,white
|
158
158
|
Women,Jackets and Coats,zipped jacket,blue
|
159
|
-
Women,Jackets and Coats,loose-fitted jacket,
|
159
|
+
Women,Jackets and Coats,loose-fitted jacket,light-blue
|
160
160
|
Women,Jackets and Coats,double-breasted jacket,white
|
161
161
|
Women,Jackets and Coats,leather biker jacket,black
|
162
162
|
Women,Jackets and Coats,wool-blend coat with belt,burgundy
|
@@ -166,7 +166,7 @@ Women,Jackets and Coats,bomber jacket,khaki
|
|
166
166
|
Sportswear,Tops,sports bra low support,grey
|
167
167
|
Sportswear,Tops,sports bra low support,lila
|
168
168
|
Sportswear,Tops,long sleeves yoga crop top,mint
|
169
|
-
Sportswear,Tops,long sleeves yoga crop top,
|
169
|
+
Sportswear,Tops,long sleeves yoga crop top,light-blue
|
170
170
|
Sportswear,Tops,long sleeves yoga crop top,pink
|
171
171
|
Sportswear,Tops,oversize t-shirt wrapped on back,pink
|
172
172
|
Sportswear,Tops,long sleeves crop top,black
|
@@ -176,12 +176,12 @@ Sportswear,Tops,sports bra,green
|
|
176
176
|
Sportswear,Tops,sports bra,blue
|
177
177
|
Sportswear,Tops,sports bra,burgundy
|
178
178
|
Sportswear,Tops,sport cropp top,burgundy
|
179
|
-
Sportswear,Sweatshirts,running sweatshirt,
|
179
|
+
Sportswear,Sweatshirts,running sweatshirt,light-blue
|
180
180
|
Sportswear,Sweatshirts,lightweight running jacket,grey
|
181
181
|
Sportswear,Sweatshirts,oversize sweatshirt,pink
|
182
182
|
Sportswear,Sweatshirts,sport windproof jacket,blue
|
183
183
|
Sportswear,Sweatshirts,sport waistcoat,purple
|
184
|
-
Sportswear,Pants,shined pants,
|
184
|
+
Sportswear,Pants,shined pants,light-blue
|
185
185
|
Sportswear,Pants,shined pants,grey
|
186
186
|
Sportswear,Pants,shined pants,black
|
187
187
|
Sportswear,Pants,short pants,black
|