spree_sample 4.0.9 → 4.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28c2c34a9e33734bb21362a69652ede8ae47a1d96649040805806dc077c273e1
4
- data.tar.gz: 8dc2e126a9fa2f65419b8ede1eb05040eaf655949a996f6498d8a5315541782b
3
+ metadata.gz: bde4b77247eb957c7ba1f7024161aa1b541065ad55f07fbff5f4a4827e1a87fb
4
+ data.tar.gz: ae47cd09af331919b27f9629d146727880e976992a3300d5677b9eb8edea7d48
5
5
  SHA512:
6
- metadata.gz: cd4831419fb9cd18ff0963b8e9920a9c9244d9d326a0b2cd61e9272d72c9337a3bbe581802f752e80318a9f58f9823d7cca900cbe91afe14ee88247ecd7b1d34
7
- data.tar.gz: 6ebda3ada92f184f18b2a2d90986e7196f627ad24f94d01081171f4c4293d379b5ade530652c35dfec3dcad2bb178f72ea5a847154c6875310dd2579b56e0474
6
+ metadata.gz: 7a6fde1ce562ec12480d7207cb5dcd59c5529175154611b8e967966b78d32b0638e28a2484136d7e7a2ad8cd08fa88a5bb32444ea4b39f18d511f63fab0442fb
7
+ data.tar.gz: 840c01a766fe0b88657d3335403bab07283772e6eb7f1aaad7cf1f1bf719ca41b78d12d9250618e7a958edcd0b6b32d567de35ce7fab7cb650bb4d20ef736172
@@ -3,8 +3,10 @@ Spree::Sample.load_sample('orders')
3
3
  first_order = Spree::Order.find_by!(number: 'R123456789')
4
4
  last_order = Spree::Order.find_by!(number: 'R987654321')
5
5
 
6
+ tax_rate = Spree::TaxRate.find_by!(name: 'California')
7
+
6
8
  first_order.adjustments.where(
7
- source: Spree::TaxRate.find_by!(name: 'North America'),
9
+ source: tax_rate,
8
10
  order: first_order,
9
11
  label: 'Tax',
10
12
  state: 'open',
@@ -14,7 +16,7 @@ first_order.adjustments.where(
14
16
  end
15
17
 
16
18
  last_order.adjustments.where(
17
- source: Spree::TaxRate.find_by!(name: 'North America'),
19
+ source: tax_rate,
18
20
  order: last_order,
19
21
  label: 'Tax',
20
22
  state: 'open',
@@ -1,14 +1,19 @@
1
1
  option_types_attributes = [
2
2
  {
3
- name: 'tshirt-size',
4
- presentation: 'Size',
3
+ name: 'color',
4
+ presentation: 'Color',
5
5
  position: 1
6
6
  },
7
7
  {
8
- name: 'tshirt-color',
9
- presentation: 'Color',
8
+ name: 'length',
9
+ presentation: 'Length',
10
10
  position: 2
11
- }
11
+ },
12
+ {
13
+ name: 'size',
14
+ presentation: 'Size',
15
+ position: 3
16
+ },
12
17
  ]
13
18
 
14
19
  option_types_attributes.each do |attrs|
@@ -1,53 +1,55 @@
1
1
  Spree::Sample.load_sample('option_types')
2
2
 
3
- size = Spree::OptionType.find_by!(presentation: 'Size')
4
- color = Spree::OptionType.find_by!(presentation: 'Color')
3
+ color_option_type = Spree::OptionType.find_by!(name: 'color')
4
+ length_option_type = Spree::OptionType.find_by!(name: 'length')
5
+ size_option_type = Spree::OptionType.find_by!(name: 'size')
5
6
 
6
- option_values_attributes = [
7
- {
8
- name: 'Small',
9
- presentation: 'S',
10
- position: 1,
11
- option_type: size
12
- },
13
- {
14
- name: 'Medium',
15
- presentation: 'M',
16
- position: 2,
17
- option_type: size
18
- },
19
- {
20
- name: 'Large',
21
- presentation: 'L',
22
- position: 3,
23
- option_type: size
24
- },
25
- {
26
- name: 'Extra Large',
27
- presentation: 'XL',
28
- position: 4,
29
- option_type: size
30
- },
31
- {
32
- name: 'Red',
33
- presentation: 'Red',
34
- position: 1,
35
- option_type: color
36
- },
37
- {
38
- name: 'Green',
39
- presentation: 'Green',
40
- position: 2,
41
- option_type: color
42
- },
43
- {
44
- name: 'Blue',
45
- presentation: 'Blue',
46
- position: 3,
47
- option_type: color
48
- }
49
- ]
7
+ colors = {
8
+ white: '#FFFFFF',
9
+ purple: '#800080',
10
+ red: '#FF0000',
11
+ black: '#000000',
12
+ brown: '#8B4513',
13
+ green: '#228C22',
14
+ grey: '#808080',
15
+ orange: '#FF8800',
16
+ burgundy: '#A8003B',
17
+ beige: '#E1C699',
18
+ mint: '#AAF0D1',
19
+ blue: '#0000FF',
20
+ dark_blue: '#00008b',
21
+ khaki: '#BDB76B',
22
+ yellow: '#FFFF00',
23
+ light_blue: '#add8e6',
24
+ pink: '#FFA6C9',
25
+ lila: '#cf9de6',
26
+ ecru: '#F4F2D6'
27
+ }
50
28
 
51
- option_values_attributes.each do |attrs|
52
- Spree::OptionValue.where(attrs).first_or_create!
29
+ lengths = { mini: 'Mini', midi: 'Midi', maxi: 'Maxi' }
30
+
31
+ sizes = { xs: 'XS', s: 'S', m: 'M', l: 'L', xl: 'XL' }
32
+
33
+ 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
+ )
47
+ end
48
+
49
+ 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
+ )
53
55
  end
data/db/samples/orders.rb CHANGED
@@ -1,39 +1,43 @@
1
1
  Spree::Sample.load_sample('addresses')
2
+ Spree::Sample.load_sample('products')
3
+
4
+ product_1 = Spree::Product.find_by!(name: 'Denim Shirt')
5
+ product_2 = Spree::Product.find_by!(name: 'Checked Shirt')
2
6
 
3
7
  orders = []
4
8
  orders << Spree::Order.where(
5
9
  number: 'R123456789',
6
10
  email: 'spree@example.com'
7
11
  ).first_or_create! do |order|
8
- order.item_total = 150.95
9
- order.adjustment_total = 150.95
10
- order.total = 301.90
12
+ order.item_total = product_1.master.price
13
+ order.adjustment_total = product_1.master.price
14
+ order.total = product_1.master.price * 2
11
15
  end
12
16
 
13
17
  orders << Spree::Order.where(
14
18
  number: 'R987654321',
15
19
  email: 'spree@example.com'
16
20
  ).first_or_create! do |order|
17
- order.item_total = 15.95
18
- order.adjustment_total = 15.95
19
- order.total = 31.90
21
+ order.item_total = product_2.master.price
22
+ order.adjustment_total = product_2.master.price
23
+ order.total = product_2.master.price * 2
20
24
  order.shipping_address = Spree::Address.first
21
25
  order.billing_address = Spree::Address.last
22
26
  end
23
27
 
24
28
  unless orders[0].line_items.any?
25
29
  orders[0].line_items.new(
26
- variant: Spree::Product.find_by!(name: 'Ruby on Rails Tote').master,
30
+ variant: product_1.master,
27
31
  quantity: 1,
28
- price: 15.99
32
+ price: product_1.master.price
29
33
  ).save!
30
34
  end
31
35
 
32
36
  unless orders[1].line_items.any?
33
37
  orders[1].line_items.new(
34
- variant: Spree::Product.find_by!(name: 'Ruby on Rails Bag').master,
38
+ variant: product_2.master,
35
39
  quantity: 1,
36
- price: 22.99
40
+ price: product_1.master.price
37
41
  ).save!
38
42
  end
39
43
 
@@ -1,118 +1,103 @@
1
- products =
1
+ Spree::Sample.load_sample('taxons')
2
+ Spree::Sample.load_sample('products')
3
+
4
+ men_tshirts_properties = [
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
+ },
2
25
  {
3
- 'Ruby on Rails Baseball Jersey' =>
4
- {
5
- 'Manufacturer' => 'Wilson',
6
- 'Brand' => 'Wannabe Sports',
7
- 'Model' => 'JK1002',
8
- 'Shirt Type' => 'Baseball Jersey',
9
- 'Sleeve Type' => 'Long',
10
- 'Made from' => '100% cotton',
11
- 'Fit' => 'Loose',
12
- 'Gender' => 'Men\'s'
13
- },
14
- 'Ruby on Rails Jr. Spaghetti' =>
15
- {
16
- 'Manufacturer' => 'Jerseys',
17
- 'Brand' => 'Resiliance',
18
- 'Model' => 'TL174',
19
- 'Shirt Type' => 'Jr. Spaghetti T',
20
- 'Sleeve Type' => 'None',
21
- 'Made from' => '90% Cotton, 10% Nylon',
22
- 'Fit' => 'Form',
23
- 'Gender' => 'Women\'s'
24
- },
25
- 'Ruby on Rails Ringer T-Shirt' =>
26
- {
27
- 'Manufacturer' => 'Jerseys',
28
- 'Brand' => 'Conditioned',
29
- 'Model' => 'TL9002',
30
- 'Shirt Type' => 'Ringer T',
31
- 'Sleeve Type' => 'Short',
32
- 'Made from' => '100% Vellum',
33
- 'Fit' => 'Loose',
34
- 'Gender' => 'Men\'s'
35
- },
36
- 'Ruby on Rails Tote' =>
37
- {
38
- 'Type' => 'Tote',
39
- 'Size' => %{15' x 18' x 6'},
40
- 'Material' => 'Canvas'
41
- },
42
- 'Ruby on Rails Bag' =>
43
- {
44
- 'Type' => 'Messenger',
45
- 'Size' => %{14 1/2' x 12' x 5'},
46
- 'Material' => '600 Denier Polyester'
47
- },
48
- 'Ruby on Rails Mug' =>
49
- {
50
- 'Type' => 'Mug',
51
- 'Size' => %{4.5' tall, 3.25' dia.}
52
- },
53
- 'Ruby on Rails Stein' =>
54
- {
55
- 'Type' => 'Stein',
56
- 'Size' => %{6.75' tall, 3.75' dia. base, 3' dia. rim}
57
- },
58
- 'Spree Stein' =>
59
- {
60
- 'Type' => 'Stein',
61
- 'Size' => %{6.75' tall, 3.75' dia. base, 3' dia. rim}
62
- },
63
- 'Spree Mug' =>
64
- {
65
- 'Type' => 'Mug',
66
- 'Size' => %{4.5' tall, 3.25' dia.}
67
- },
68
- 'Spree Tote' =>
69
- {
70
- 'Type' => 'Tote',
71
- 'Size' => %{15' x 18' x 6'}
72
- },
73
- 'Spree Bag' =>
74
- {
75
- 'Type' => 'Messenger',
76
- 'Size' => %{14 1/2' x 12' x 5'}
77
- },
78
- 'Spree Baseball Jersey' =>
79
- {
80
- 'Manufacturer' => 'Wilson',
81
- 'Brand' => 'Wannabe Sports',
82
- 'Model' => 'JK1002',
83
- 'Shirt Type' => 'Baseball Jersey',
84
- 'Sleeve Type' => 'Long',
85
- 'Made from' => '100% cotton',
86
- 'Fit' => 'Loose',
87
- 'Gender' => 'Men\'s'
88
- },
89
- 'Spree Jr. Spaghetti' =>
90
- {
91
- 'Manufacturer' => 'Jerseys',
92
- 'Brand' => 'Resiliance',
93
- 'Model' => 'TL174',
94
- 'Shirt Type' => 'Jr. Spaghetti T',
95
- 'Sleeve Type' => 'None',
96
- 'Made from' => '90% Cotton, 10% Nylon',
97
- 'Fit' => 'Form',
98
- 'Gender' => 'Women\'s'
99
- },
100
- 'Spree Ringer T-Shirt' =>
101
- {
102
- 'Manufacturer' => 'Jerseys',
103
- 'Brand' => 'Conditioned',
104
- 'Model' => 'TL9002',
105
- 'Shirt Type' => 'Ringer T',
106
- 'Sleeve Type' => 'Short',
107
- 'Made from' => '100% Vellum',
108
- 'Fit' => 'Loose',
109
- 'Gender' => 'Men\'s'
110
- }
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'
111
44
  }
45
+ ]
112
46
 
113
- products.each do |name, properties|
114
- product = Spree::Product.find_by(name: name)
115
- properties.each do |prop_name, prop_value|
116
- product.set_property(prop_name, prop_value)
47
+ Spree::Taxon.find_by!(name: 'Men').children.find_by!(name: 'T-shirts').products.each do |product|
48
+ men_tshirts_properties.sample.each do |prop_name, prop_value|
49
+ product.set_property(prop_name, prop_value, prop_name.gsub('_', ' ').capitalize)
117
50
  end
118
51
  end
52
+
53
+ women_tshirts_properties = [
54
+ {
55
+ 'manufacturer' => 'Jerseys',
56
+ 'brand' => 'Resiliance',
57
+ 'model' => 'TL174',
58
+ 'shirt_type' => 'Jr. Spaghetti T',
59
+ 'sleeve_type' => 'None',
60
+ 'material' => '90% Cotton, 10% Nylon',
61
+ 'fit' => 'Form',
62
+ 'gender' => 'Women\'s'
63
+ },
64
+ {
65
+ 'manufacturer' => 'Jerseys',
66
+ 'brand' => 'Resiliance',
67
+ 'model' => 'TL174',
68
+ 'shirt_type' => 'Jr. Spaghetti T',
69
+ 'sleeve_type' => 'None',
70
+ 'material' => '90% Cotton, 10% Nylon',
71
+ 'fit' => 'Form',
72
+ 'gender' => 'Women\'s'
73
+ }
74
+ ]
75
+
76
+ Spree::Taxon.find_by!(name: 'Women').children.find_by!(name: 'Tops and T-shirts').products.each do |product|
77
+ women_tshirts_properties.sample.each do |prop_name, prop_value|
78
+ product.set_property(prop_name, prop_value, prop_name.gsub('_', ' ').capitalize)
79
+ end
80
+ end
81
+
82
+ properties = {
83
+ manufacturers: %w[Wilson Jerseys Wannabe Resiliance Conditioned],
84
+ brands: %w[Alpha Beta Gamma Delta Theta Epsilon Zeta],
85
+ materials: ['90% Cotton 10% Elastan', '50% Cotton 50% Elastan', '10% Cotton 90% Elastan'],
86
+ fits: %w[Form Lose]
87
+ }
88
+
89
+ t_shirts_taxon = Spree::Taxon.where(name: ['T-shirts', 'Tops and T-shirts'])
90
+
91
+ Spree::Product.all.each do |product|
92
+ product.set_property(:type, product.taxons.first.name)
93
+ product.set_property(:collection, product.taxons.first.name)
94
+
95
+ next if product.taxons.include?(t_shirts_taxon)
96
+
97
+ product.set_property(:manufacturer, properties[:manufacturers].sample)
98
+ product.set_property(:brand, properties[:brands].sample)
99
+ product.set_property(:material, properties[:materials].sample)
100
+ product.set_property(:fit, properties[:fits].sample)
101
+ product.set_property(:gender, (product.taxons.pluck(:name).include?('Men') ? 'Men\'s' : 'Women\'s'))
102
+ product.set_property(:model, product.sku)
103
+ end
@@ -1,124 +1,37 @@
1
+ require 'csv'
2
+
1
3
  Spree::Sample.load_sample('tax_categories')
2
4
  Spree::Sample.load_sample('shipping_categories')
5
+ Spree::Sample.load_sample('option_types')
6
+ Spree::Sample.load_sample('taxons')
3
7
 
4
- clothing = Spree::TaxCategory.find_by!(name: 'Clothing')
5
-
6
- products = [
7
- {
8
- name: 'Ruby on Rails Tote',
9
- tax_category: clothing,
10
- price: 15.99,
11
- eur_price: 14
12
- },
13
- {
14
- name: 'Ruby on Rails Bag',
15
- tax_category: clothing,
16
- price: 22.99,
17
- eur_price: 19
18
- },
19
- {
20
- name: 'Ruby on Rails Baseball Jersey',
21
- tax_category: clothing,
22
- price: 19.99,
23
- eur_price: 16
24
- },
25
- {
26
- name: 'Ruby on Rails Jr. Spaghetti',
27
- tax_category: clothing,
28
- price: 19.99,
29
- eur_price: 16
8
+ default_shipping_category = Spree::ShippingCategory.find_by!(name: 'Default')
9
+ clothing_tax_category = Spree::TaxCategory.find_by!(name: 'Clothing')
30
10
 
31
- },
32
- {
33
- name: 'Ruby on Rails Ringer T-Shirt',
34
- tax_category: clothing,
35
- price: 19.99,
36
- eur_price: 16
37
- },
38
- {
39
- name: 'Ruby Baseball Jersey',
40
- tax_category: clothing,
41
- price: 19.99,
42
- eur_price: 16
43
- },
44
- {
45
- name: 'Apache Baseball Jersey',
46
- tax_category: clothing,
47
- price: 19.99,
48
- eur_price: 16
49
- },
50
- {
51
- name: 'Spree Baseball Jersey',
52
- tax_category: clothing,
53
- price: 19.99,
54
- eur_price: 16
55
- },
56
- {
57
- name: 'Spree Jr. Spaghetti',
58
- tax_category: clothing,
59
- price: 19.99,
60
- eur_price: 16
61
- },
62
- {
63
- name: 'Spree Ringer T-Shirt',
64
- tax_category: clothing,
65
- price: 19.99,
66
- eur_price: 16
67
- },
68
- {
69
- name: 'Spree Tote',
70
- tax_category: clothing,
71
- price: 15.99,
72
- eur_price: 14
73
- },
74
- {
75
- name: 'Spree Bag',
76
- tax_category: clothing,
77
- price: 22.99,
78
- eur_price: 19
79
- },
80
- {
81
- name: 'Ruby on Rails Mug',
82
- price: 13.99,
83
- eur_price: 12
84
- },
85
- {
86
- name: 'Ruby on Rails Stein',
87
- price: 16.99,
88
- eur_price: 14
89
- },
90
- {
91
- name: 'Spree Stein',
92
- price: 16.99,
93
- eur_price: 14
94
- },
95
- {
96
- name: 'Spree Mug',
97
- price: 13.99,
98
- eur_price: 12
99
- }
100
- ]
11
+ Spree::Config[:currency] = 'USD'
101
12
 
102
- default_shipping_category = Spree::ShippingCategory.find_by!(name: 'Default')
13
+ color = Spree::OptionType.find_by!(name: 'color')
14
+ size = Spree::OptionType.find_by!(name: 'size')
103
15
 
104
- products.each do |product_attrs|
105
- Spree::Config[:currency] = 'USD'
106
- eur_price = product_attrs.delete(:eur_price)
16
+ PRODUCTS = CSV.read(File.join(__dir__, 'variants.csv')).map do |(parent_name, taxon_name, product_name, _color_name)|
17
+ [parent_name, taxon_name, product_name]
18
+ end.uniq
107
19
 
108
- new_product = Spree::Product.where(name: product_attrs[:name],
109
- tax_category: product_attrs[:tax_category]).first_or_create! do |product|
110
- product.price = product_attrs[:price]
20
+ PRODUCTS.each do |(parent_name, taxon_name, product_name)|
21
+ parent = Spree::Taxon.find_by!(name: parent_name)
22
+ taxon = parent.children.find_by!(name: taxon_name)
23
+ taxon.products.where(name: product_name.titleize).first_or_create! do |product|
24
+ product.price = rand(10...100) + 0.99
111
25
  product.description = FFaker::Lorem.paragraph
112
26
  product.available_on = Time.zone.now
27
+ product.option_types = [color, size]
113
28
  product.shipping_category = default_shipping_category
29
+ product.tax_category = clothing_tax_category
30
+ product.sku = [taxon_name.delete(' '), product_name.delete(' '), product.price].join('_')
31
+ parent.products << product
114
32
  end
115
-
116
- next unless new_product
117
-
118
- Spree::Config[:currency] = 'EUR'
119
- new_product.reload
120
- new_product.price = eur_price
121
- new_product.save
122
33
  end
123
34
 
124
- Spree::Config[:currency] = 'USD'
35
+ ['Bestsellers', 'New', 'Trending', 'Streetstyle', 'Summer Sale'].each do |taxon_name|
36
+ Spree::Taxon.find_by!(name: taxon_name).products << Spree::Product.all.sample(30)
37
+ end
@@ -1,9 +1,9 @@
1
1
  Spree::Sample.load_sample('option_values')
2
2
  Spree::Sample.load_sample('products')
3
3
 
4
- product = Spree::Product.find_by(name: 'Ruby on Rails Baseball Jersey')
5
- size = Spree::OptionValue.find_by(name: 'Small')
6
- color = Spree::OptionValue.find_by(name: 'Red')
4
+ product = Spree::Product.find_by!(name: 'Denim Shirt')
5
+ size = Spree::OptionValue.find_by!(name: 'xs')
6
+ color = Spree::OptionValue.find_by!(name: 'red')
7
7
  eligible_values = "#{size.id},#{color.id}"
8
8
 
9
9
  promotion = Spree::Promotion.where(
@@ -12,12 +12,12 @@ promotion = Spree::Promotion.where(
12
12
  path: nil,
13
13
  match_policy: 'any',
14
14
  description: ''
15
- ).first_or_create
15
+ ).first_or_create!
16
16
 
17
17
  Spree::PromotionRule.where(
18
18
  promotion_id: promotion.id,
19
19
  type: 'Spree::Promotion::Rules::OptionValue',
20
20
  preferences: { match_policy: 'any', eligible_values: { product.id.to_s => eligible_values } }
21
- ).first_or_create
21
+ ).first_or_create!
22
22
 
23
- Spree::Promotion::Actions::FreeShipping.where(promotion_id: promotion.id).first_or_create
23
+ Spree::Promotion::Actions::FreeShipping.where(promotion_id: promotion.id).first_or_create!
@@ -0,0 +1,18 @@
1
+ properties = {
2
+ brand: 'Brand',
3
+ model: 'Model',
4
+ manufacturer: 'Manufacturer',
5
+ made_from: 'Made from',
6
+ fit: 'Fit',
7
+ gender: 'Gender',
8
+ type: 'Type',
9
+ size: 'Size',
10
+ material: 'Material',
11
+ length: 'Lenght',
12
+ color: 'Color',
13
+ collection: 'Collection'
14
+ }
15
+
16
+ properties.each do |name, presentation|
17
+ Spree::Property.where(name: name, presentation: presentation).first_or_create!
18
+ end
@@ -1,7 +1,9 @@
1
+ Spree::Sample.load_sample('properties')
2
+
1
3
  prototypes = [
2
4
  {
3
5
  name: 'Shirt',
4
- properties: ['Manufacturer', 'Brand', 'Model', 'Shirt Type', 'Sleeve Type', 'Material', 'Fit', 'Gender']
6
+ properties: ['Manufacturer', 'Brand', 'Model', 'Lenght', 'Made from', 'Material', 'Fit', 'Gender']
5
7
  },
6
8
  {
7
9
  name: 'Bag',
@@ -15,8 +17,8 @@ prototypes = [
15
17
 
16
18
  prototypes.each do |prototype_attrs|
17
19
  prototype = Spree::Prototype.where(name: prototype_attrs[:name]).first_or_create!
18
- prototype_attrs[:properties].each do |property_name|
19
- property = Spree::Property.where(name: property_name).first
20
+ prototype_attrs[:properties].each do |property_presentation|
21
+ property = Spree::Property.find_by!(presentation: property_presentation)
20
22
  prototype.properties << property unless prototype.properties.include?(property)
21
23
  end
22
24
  end
@@ -0,0 +1,13 @@
1
+ [
2
+ 'Better price available',
3
+ 'Missed estimated delivery date',
4
+ 'Missing parts or accessories',
5
+ 'Damaged/Defective',
6
+ 'Different from what was ordered',
7
+ 'Different from description',
8
+ 'No longer needed/wanted',
9
+ 'Accidental order',
10
+ 'Unauthorized purchase',
11
+ ].each do |name|
12
+ Spree::ReturnAuthorizationReason.find_or_create_by!(name: name)
13
+ end