diff --git a/sample/db/samples/assets.rb b/sample/db/samples/assets.rb index f025315f67c..6ae7670d5fd 100644 --- a/sample/db/samples/assets.rb +++ b/sample/db/samples/assets.rb @@ -7,20 +7,22 @@ Spree::Sample.load_sample("variants") products = {} -products[:solidus_tshirt] = Spree::Product.includes(variants: [:option_values]).find_by!(name: "Solidus T-Shirt") -products[:solidus_long] = Spree::Product.includes(variants: [:option_values]).find_by!(name: "Solidus Long Sleeve") -products[:solidus_womens_tshirt] = Spree::Product.includes(variants: [:option_values]).find_by!(name: "Solidus Women's T-Shirt") -products[:solidus_snapback_cap] = Spree::Product.find_by!(name: "Solidus Snapback Cap") -products[:solidus_hoodie] = Spree::Product.find_by!(name: "Solidus Hoodie Zip") -products[:ruby_hoodie] = Spree::Product.find_by!(name: "Ruby Hoodie") -products[:ruby_hoodie_zip] = Spree::Product.find_by!(name: "Ruby Hoodie Zip") -products[:ruby_polo] = Spree::Product.find_by!(name: "Ruby Polo") -products[:solidus_mug] = Spree::Product.find_by!(name: "Solidus Mug") -products[:ruby_mug] = Spree::Product.find_by!(name: "Ruby Mug") -products[:solidus_tote] = Spree::Product.find_by!(name: "Solidus Tote") -products[:ruby_tote] = Spree::Product.find_by!(name: "Ruby Tote") +products[:solidus_bottles] = Spree::Product.includes(variants: [:option_values]).find_by!(name: "Solidus Water Bottle") +products[:solidus_tote] = Spree::Product.includes(variants: [:option_values]).find_by!(name: "Solidus tote") +products[:solidus_hoodie] = Spree::Product.includes(variants: [:option_values]).find_by!(name: "Solidus hoodie") +products[:solidus_hat] = Spree::Product.includes(variants: [:option_values]).find_by!(name: "Solidus winter hat") +products[:solidus_sticker] = Spree::Product.includes(variants: [:option_values]).find_by!(name: "Solidus circle sticker") +products[:solidus_cap] = Spree::Product.includes(variants: [:option_values]).find_by!(name: "Solidus cap") -image = ->(name, type = "jpg") do +products[:solidus_mug_set] = Spree::Product.find_by!(name: "Solidus mug set") +products[:solidus_notebook] = Spree::Product.find_by!(name: "Solidus notebook") +products[:solidus_tshirt] = Spree::Product.find_by!(name: "Solidus t-shirt") +products[:solidus_long_sleeve_tee] = Spree::Product.find_by!(name: "Solidus long sleeve tee") +products[:solidus_dark_tee] = Spree::Product.find_by!(name: "Solidus dark tee") +products[:solidus_canvas_tote] = Spree::Product.find_by!(name: "Solidus canvas tote bag") +products[:solidus_cap] = Spree::Product.find_by!(name: "Solidus cap") + +def image(name, type = "png") images_path = Pathname.new(File.dirname(__FILE__)) + "images" path = images_path + "#{name}.#{type}" @@ -30,91 +32,83 @@ end images = { - products[:solidus_snapback_cap].master => [ + products[:solidus_bottles].master => [ + { + attachment: image("solidus_bottles") + } + ], + products[:solidus_tote].master => [ { - attachment: image["solidus_snapback_cap"] + attachment: image("solidus_tote") } ], products[:solidus_hoodie].master => [ { - attachment: image["solidus_hoodie"] + attachment: image("solidus_hoodie") } ], - products[:ruby_hoodie].master => [ + products[:solidus_hat].master => [ { - attachment: image["ruby_hoodie"] + attachment: image("solidus_hat") } ], - products[:ruby_hoodie_zip].master => [ + products[:solidus_sticker].master => [ { - attachment: image["ruby_hoodie_zip"] + attachment: image("solidus_sticker") } ], - products[:ruby_polo].master => [ + products[:solidus_mug_set].master => [ { - attachment: image["ruby_polo"] - }, + attachment: image("solidus_mug_set") + } + ], + products[:solidus_notebook].master => [ { - attachment: image["ruby_polo_back"] + attachment: image("solidus_notebook") } ], - products[:solidus_mug].master => [ + products[:solidus_tshirt].master => [ { - attachment: image["solidus_mug"] + attachment: image("solidus_tshirt") } ], - products[:ruby_mug].master => [ + products[:solidus_long_sleeve_tee].master => [ { - attachment: image["ruby_mug"] + attachment: image("solidus_long_sleeve_tee") } ], - products[:solidus_tote].master => [ + products[:solidus_dark_tee].master => [ + { + attachment: image("solidus_dark_tee") + } + ], + products[:solidus_canvas_tote].master => [ { - attachment: image["tote_bag_solidus"] + attachment: image("solidus_canvas_tote") } ], - products[:ruby_tote].master => [ + products[:solidus_cap].master => [ { - attachment: image["tote_bag_ruby"] + attachment: image("solidus_cap") } - ] + ], } -products[:solidus_tshirt].variants.each do |variant| - color = variant.option_value("clothing-color").downcase - main_image = image["solidus_tshirt_#{color}", "jpg"] - File.open(main_image) do |f| - variant.images.create!(attachment: f) - end - back_image = image["solidus_tshirt_back_#{color}", "jpg"] - - next unless back_image +products.each do |key, product| + product.reload.variants.each do |variant| + color = variant.option_value("clothing-color").downcase + index = 1 - File.open(back_image) do |f| - variant.images.create!(attachment: f) - end -end + loop do + image_path = image("#{key}_#{color}_#{index}", 'png') + break unless image_path -products[:solidus_long].variants.each do |variant| - color = variant.option_value("clothing-color").downcase - main_image = image["solidus_long_#{color}", "jpg"] - File.open(main_image) do |f| - variant.images.create!(attachment: f) - end - back_image = image["solidus_long_back_#{color}", "jpg"] + File.open(image_path) do |f| + variant.images.create!(attachment: f) + end - next unless back_image - - File.open(back_image) do |f| - variant.images.create!(attachment: f) - end -end - -products[:solidus_womens_tshirt].reload.variants.each do |variant| - color = variant.option_value("clothing-color").downcase - main_image = image["solidus_womens_tshirt_#{color}", "jpg"] - File.open(main_image) do |f| - variant.images.create!(attachment: f) + index += 1 + end end end diff --git a/sample/db/samples/images/ruby_hoodie.jpg b/sample/db/samples/images/ruby_hoodie.jpg deleted file mode 100644 index 238678217ef..00000000000 Binary files a/sample/db/samples/images/ruby_hoodie.jpg and /dev/null differ diff --git a/sample/db/samples/images/ruby_hoodie_zip.jpg b/sample/db/samples/images/ruby_hoodie_zip.jpg deleted file mode 100644 index 3ccea9d9ac9..00000000000 Binary files a/sample/db/samples/images/ruby_hoodie_zip.jpg and /dev/null differ diff --git a/sample/db/samples/images/ruby_mug.jpg b/sample/db/samples/images/ruby_mug.jpg deleted file mode 100644 index 680b87a788a..00000000000 Binary files a/sample/db/samples/images/ruby_mug.jpg and /dev/null differ diff --git a/sample/db/samples/images/ruby_polo.jpg b/sample/db/samples/images/ruby_polo.jpg deleted file mode 100644 index 98d5b219580..00000000000 Binary files a/sample/db/samples/images/ruby_polo.jpg and /dev/null differ diff --git a/sample/db/samples/images/ruby_polo_back.jpg b/sample/db/samples/images/ruby_polo_back.jpg deleted file mode 100644 index 607a18e7045..00000000000 Binary files a/sample/db/samples/images/ruby_polo_back.jpg and /dev/null differ diff --git a/sample/db/samples/images/solidus_bottles.png b/sample/db/samples/images/solidus_bottles.png new file mode 100644 index 00000000000..872596215d5 Binary files /dev/null and b/sample/db/samples/images/solidus_bottles.png differ diff --git a/sample/db/samples/images/solidus_canvas_tote.png b/sample/db/samples/images/solidus_canvas_tote.png new file mode 100644 index 00000000000..2ab68885a7b Binary files /dev/null and b/sample/db/samples/images/solidus_canvas_tote.png differ diff --git a/sample/db/samples/images/solidus_cap.png b/sample/db/samples/images/solidus_cap.png new file mode 100644 index 00000000000..9d9990d9a7b Binary files /dev/null and b/sample/db/samples/images/solidus_cap.png differ diff --git a/sample/db/samples/images/solidus_cap_black_1.png b/sample/db/samples/images/solidus_cap_black_1.png new file mode 100644 index 00000000000..9d9990d9a7b Binary files /dev/null and b/sample/db/samples/images/solidus_cap_black_1.png differ diff --git a/sample/db/samples/images/solidus_cap_black_2.png b/sample/db/samples/images/solidus_cap_black_2.png new file mode 100644 index 00000000000..c9caf9a61d4 Binary files /dev/null and b/sample/db/samples/images/solidus_cap_black_2.png differ diff --git a/sample/db/samples/images/solidus_cap_black_3.png b/sample/db/samples/images/solidus_cap_black_3.png new file mode 100644 index 00000000000..9134019a16e Binary files /dev/null and b/sample/db/samples/images/solidus_cap_black_3.png differ diff --git a/sample/db/samples/images/solidus_cap_gray_1.png b/sample/db/samples/images/solidus_cap_gray_1.png new file mode 100644 index 00000000000..5f1000aca26 Binary files /dev/null and b/sample/db/samples/images/solidus_cap_gray_1.png differ diff --git a/sample/db/samples/images/solidus_cap_gray_2.png b/sample/db/samples/images/solidus_cap_gray_2.png new file mode 100644 index 00000000000..5a76658d992 Binary files /dev/null and b/sample/db/samples/images/solidus_cap_gray_2.png differ diff --git a/sample/db/samples/images/solidus_cap_gray_3.png b/sample/db/samples/images/solidus_cap_gray_3.png new file mode 100644 index 00000000000..3f2ceff9611 Binary files /dev/null and b/sample/db/samples/images/solidus_cap_gray_3.png differ diff --git a/sample/db/samples/images/solidus_cap_red_1.png b/sample/db/samples/images/solidus_cap_red_1.png new file mode 100644 index 00000000000..3589163a72a Binary files /dev/null and b/sample/db/samples/images/solidus_cap_red_1.png differ diff --git a/sample/db/samples/images/solidus_cap_red_2.png b/sample/db/samples/images/solidus_cap_red_2.png new file mode 100644 index 00000000000..771f8804ce9 Binary files /dev/null and b/sample/db/samples/images/solidus_cap_red_2.png differ diff --git a/sample/db/samples/images/solidus_cap_red_3.png b/sample/db/samples/images/solidus_cap_red_3.png new file mode 100644 index 00000000000..7e71affa3e9 Binary files /dev/null and b/sample/db/samples/images/solidus_cap_red_3.png differ diff --git a/sample/db/samples/images/solidus_dark_tee.png b/sample/db/samples/images/solidus_dark_tee.png new file mode 100644 index 00000000000..6051cde2aa0 Binary files /dev/null and b/sample/db/samples/images/solidus_dark_tee.png differ diff --git a/sample/db/samples/images/solidus_hat.png b/sample/db/samples/images/solidus_hat.png new file mode 100644 index 00000000000..c552acaa30b Binary files /dev/null and b/sample/db/samples/images/solidus_hat.png differ diff --git a/sample/db/samples/images/solidus_hoodie.jpg b/sample/db/samples/images/solidus_hoodie.jpg deleted file mode 100644 index be8ff5d437c..00000000000 Binary files a/sample/db/samples/images/solidus_hoodie.jpg and /dev/null differ diff --git a/sample/db/samples/images/solidus_hoodie.png b/sample/db/samples/images/solidus_hoodie.png new file mode 100644 index 00000000000..905c935604c Binary files /dev/null and b/sample/db/samples/images/solidus_hoodie.png differ diff --git a/sample/db/samples/images/solidus_hoodie_black_1.png b/sample/db/samples/images/solidus_hoodie_black_1.png new file mode 100644 index 00000000000..ebde146e360 Binary files /dev/null and b/sample/db/samples/images/solidus_hoodie_black_1.png differ diff --git a/sample/db/samples/images/solidus_hoodie_black_2.png b/sample/db/samples/images/solidus_hoodie_black_2.png new file mode 100644 index 00000000000..36baf74798b Binary files /dev/null and b/sample/db/samples/images/solidus_hoodie_black_2.png differ diff --git a/sample/db/samples/images/solidus_hoodie_red_1.png b/sample/db/samples/images/solidus_hoodie_red_1.png new file mode 100644 index 00000000000..ba28a93b5df Binary files /dev/null and b/sample/db/samples/images/solidus_hoodie_red_1.png differ diff --git a/sample/db/samples/images/solidus_hoodie_red_2.png b/sample/db/samples/images/solidus_hoodie_red_2.png new file mode 100644 index 00000000000..b8c92996804 Binary files /dev/null and b/sample/db/samples/images/solidus_hoodie_red_2.png differ diff --git a/sample/db/samples/images/solidus_long.jpg b/sample/db/samples/images/solidus_long.jpg deleted file mode 100644 index 5811a7cec5e..00000000000 Binary files a/sample/db/samples/images/solidus_long.jpg and /dev/null differ diff --git a/sample/db/samples/images/solidus_long_back.jpg b/sample/db/samples/images/solidus_long_back.jpg deleted file mode 100644 index d089a0c8edd..00000000000 Binary files a/sample/db/samples/images/solidus_long_back.jpg and /dev/null differ diff --git a/sample/db/samples/images/solidus_long_back_black.jpg b/sample/db/samples/images/solidus_long_back_black.jpg deleted file mode 100644 index 98cd7c60478..00000000000 Binary files a/sample/db/samples/images/solidus_long_back_black.jpg and /dev/null differ diff --git a/sample/db/samples/images/solidus_long_back_blue.jpg b/sample/db/samples/images/solidus_long_back_blue.jpg deleted file mode 100644 index 7de1d5042fb..00000000000 Binary files a/sample/db/samples/images/solidus_long_back_blue.jpg and /dev/null differ diff --git a/sample/db/samples/images/solidus_long_back_white.jpg b/sample/db/samples/images/solidus_long_back_white.jpg deleted file mode 100644 index eebfe8c3f04..00000000000 Binary files a/sample/db/samples/images/solidus_long_back_white.jpg and /dev/null differ diff --git a/sample/db/samples/images/solidus_long_black.jpg b/sample/db/samples/images/solidus_long_black.jpg deleted file mode 100644 index 2321476eeed..00000000000 Binary files a/sample/db/samples/images/solidus_long_black.jpg and /dev/null differ diff --git a/sample/db/samples/images/solidus_long_blue.jpg b/sample/db/samples/images/solidus_long_blue.jpg deleted file mode 100644 index 017db75b56e..00000000000 Binary files a/sample/db/samples/images/solidus_long_blue.jpg and /dev/null differ diff --git a/sample/db/samples/images/solidus_long_sleeve_tee.png b/sample/db/samples/images/solidus_long_sleeve_tee.png new file mode 100644 index 00000000000..8298fecba5f Binary files /dev/null and b/sample/db/samples/images/solidus_long_sleeve_tee.png differ diff --git a/sample/db/samples/images/solidus_long_white.jpg b/sample/db/samples/images/solidus_long_white.jpg deleted file mode 100644 index 23e74c6cacb..00000000000 Binary files a/sample/db/samples/images/solidus_long_white.jpg and /dev/null differ diff --git a/sample/db/samples/images/solidus_mug.jpg b/sample/db/samples/images/solidus_mug.jpg deleted file mode 100644 index 6860dada4cf..00000000000 Binary files a/sample/db/samples/images/solidus_mug.jpg and /dev/null differ diff --git a/sample/db/samples/images/solidus_mug_set.png b/sample/db/samples/images/solidus_mug_set.png new file mode 100644 index 00000000000..227f1853109 Binary files /dev/null and b/sample/db/samples/images/solidus_mug_set.png differ diff --git a/sample/db/samples/images/solidus_notebook.png b/sample/db/samples/images/solidus_notebook.png new file mode 100644 index 00000000000..d6f7a11c110 Binary files /dev/null and b/sample/db/samples/images/solidus_notebook.png differ diff --git a/sample/db/samples/images/solidus_snapback_cap.jpg b/sample/db/samples/images/solidus_snapback_cap.jpg deleted file mode 100644 index dbdbd0d0471..00000000000 Binary files a/sample/db/samples/images/solidus_snapback_cap.jpg and /dev/null differ diff --git a/sample/db/samples/images/solidus_sticker.png b/sample/db/samples/images/solidus_sticker.png new file mode 100644 index 00000000000..fd3b15a62ec Binary files /dev/null and b/sample/db/samples/images/solidus_sticker.png differ diff --git a/sample/db/samples/images/solidus_tote.png b/sample/db/samples/images/solidus_tote.png new file mode 100644 index 00000000000..a3bcc7e4720 Binary files /dev/null and b/sample/db/samples/images/solidus_tote.png differ diff --git a/sample/db/samples/images/solidus_tote_red_1.png b/sample/db/samples/images/solidus_tote_red_1.png new file mode 100644 index 00000000000..edd8da02864 Binary files /dev/null and b/sample/db/samples/images/solidus_tote_red_1.png differ diff --git a/sample/db/samples/images/solidus_tshirt.jpg b/sample/db/samples/images/solidus_tshirt.jpg deleted file mode 100644 index a7af23f0ee8..00000000000 Binary files a/sample/db/samples/images/solidus_tshirt.jpg and /dev/null differ diff --git a/sample/db/samples/images/solidus_tshirt.png b/sample/db/samples/images/solidus_tshirt.png new file mode 100644 index 00000000000..e29027ab0e0 Binary files /dev/null and b/sample/db/samples/images/solidus_tshirt.png differ diff --git a/sample/db/samples/images/solidus_tshirt_back.jpg b/sample/db/samples/images/solidus_tshirt_back.jpg deleted file mode 100644 index d84c2680412..00000000000 Binary files a/sample/db/samples/images/solidus_tshirt_back.jpg and /dev/null differ diff --git a/sample/db/samples/images/solidus_tshirt_back_black.jpg b/sample/db/samples/images/solidus_tshirt_back_black.jpg deleted file mode 100644 index aafdafa6045..00000000000 Binary files a/sample/db/samples/images/solidus_tshirt_back_black.jpg and /dev/null differ diff --git a/sample/db/samples/images/solidus_tshirt_back_blue.jpg b/sample/db/samples/images/solidus_tshirt_back_blue.jpg deleted file mode 100644 index db2cab482c7..00000000000 Binary files a/sample/db/samples/images/solidus_tshirt_back_blue.jpg and /dev/null differ diff --git a/sample/db/samples/images/solidus_tshirt_back_white.jpg b/sample/db/samples/images/solidus_tshirt_back_white.jpg deleted file mode 100644 index 25d0647c9fa..00000000000 Binary files a/sample/db/samples/images/solidus_tshirt_back_white.jpg and /dev/null differ diff --git a/sample/db/samples/images/solidus_tshirt_black.jpg b/sample/db/samples/images/solidus_tshirt_black.jpg deleted file mode 100644 index 2c7fbc0a06b..00000000000 Binary files a/sample/db/samples/images/solidus_tshirt_black.jpg and /dev/null differ diff --git a/sample/db/samples/images/solidus_tshirt_black_1.png b/sample/db/samples/images/solidus_tshirt_black_1.png new file mode 100644 index 00000000000..6bc3d54d467 Binary files /dev/null and b/sample/db/samples/images/solidus_tshirt_black_1.png differ diff --git a/sample/db/samples/images/solidus_tshirt_blue.jpg b/sample/db/samples/images/solidus_tshirt_blue.jpg deleted file mode 100644 index f385adfee03..00000000000 Binary files a/sample/db/samples/images/solidus_tshirt_blue.jpg and /dev/null differ diff --git a/sample/db/samples/images/solidus_tshirt_white.jpg b/sample/db/samples/images/solidus_tshirt_white.jpg deleted file mode 100644 index 63affac7dc8..00000000000 Binary files a/sample/db/samples/images/solidus_tshirt_white.jpg and /dev/null differ diff --git a/sample/db/samples/images/solidus_womens_tshirt.jpg b/sample/db/samples/images/solidus_womens_tshirt.jpg deleted file mode 100644 index 1190cdf724e..00000000000 Binary files a/sample/db/samples/images/solidus_womens_tshirt.jpg and /dev/null differ diff --git a/sample/db/samples/images/solidus_womens_tshirt_black.jpg b/sample/db/samples/images/solidus_womens_tshirt_black.jpg deleted file mode 100644 index 7dc5375d3f6..00000000000 Binary files a/sample/db/samples/images/solidus_womens_tshirt_black.jpg and /dev/null differ diff --git a/sample/db/samples/images/solidus_womens_tshirt_blue.jpg b/sample/db/samples/images/solidus_womens_tshirt_blue.jpg deleted file mode 100644 index 7d05762ea0e..00000000000 Binary files a/sample/db/samples/images/solidus_womens_tshirt_blue.jpg and /dev/null differ diff --git a/sample/db/samples/images/solidus_womens_tshirt_white.jpg b/sample/db/samples/images/solidus_womens_tshirt_white.jpg deleted file mode 100644 index 45b4432b37d..00000000000 Binary files a/sample/db/samples/images/solidus_womens_tshirt_white.jpg and /dev/null differ diff --git a/sample/db/samples/images/tote_bag_ruby.jpg b/sample/db/samples/images/tote_bag_ruby.jpg deleted file mode 100644 index a9b9fdb1773..00000000000 Binary files a/sample/db/samples/images/tote_bag_ruby.jpg and /dev/null differ diff --git a/sample/db/samples/images/tote_bag_solidus.jpg b/sample/db/samples/images/tote_bag_solidus.jpg deleted file mode 100644 index 752001894c5..00000000000 Binary files a/sample/db/samples/images/tote_bag_solidus.jpg and /dev/null differ diff --git a/sample/db/samples/option_values.rb b/sample/db/samples/option_values.rb index 86cc7322bda..6d56c7f8429 100644 --- a/sample/db/samples/option_values.rb +++ b/sample/db/samples/option_values.rb @@ -30,18 +30,6 @@ position: 4, option_type: size }, - { - name: "Red", - presentation: "Red", - position: 5, - option_type: color - }, - { - name: "Green", - presentation: "Green", - position: 4, - option_type: color - }, { name: "Black", presentation: "Black", @@ -49,8 +37,8 @@ option_type: color }, { - name: "White", - presentation: "White", + name: "Gray", + presentation: "Gray", position: 2, option_type: color }, @@ -59,5 +47,11 @@ presentation: "Blue", position: 3, option_type: color - } + }, + { + name: "Red", + presentation: "Red", + position: 4, + option_type: color + }, ]) diff --git a/sample/db/samples/orders.rb b/sample/db/samples/orders.rb index c0a796c3d0b..25810d27bfd 100644 --- a/sample/db/samples/orders.rb +++ b/sample/db/samples/orders.rb @@ -9,7 +9,7 @@ orders = [] orders << Spree::Order.create!( number: "R123456789", - email: "solidus@example.com", + email: "spree@example.com", item_total: 150.95, adjustment_total: 150.95, total: 301.90, @@ -19,7 +19,7 @@ orders << Spree::Order.create!( number: "R987654321", - email: "solidus@example.com", + email: "spree@example.com", item_total: 15.95, adjustment_total: 15.95, total: 31.90, @@ -28,13 +28,13 @@ ) orders[0].line_items.create!( - variant: Spree::Product.find_by!(name: "Solidus Tote").master, + variant: Spree::Product.find_by!(name: "Solidus Water Bottle").master, quantity: 1, price: 15.99 ) orders[1].line_items.create!( - variant: Spree::Product.find_by!(name: "Solidus Snapback Cap").master, + variant: Spree::Product.find_by!(name: "Solidus cap").master, quantity: 1, price: 22.99 ) diff --git a/sample/db/samples/product_option_types.rb b/sample/db/samples/product_option_types.rb index 7f5ac048260..77bbe0a1a42 100644 --- a/sample/db/samples/product_option_types.rb +++ b/sample/db/samples/product_option_types.rb @@ -5,12 +5,12 @@ size = Spree::OptionType.find_by!(presentation: "Size") color = Spree::OptionType.find_by!(presentation: "Color") -colored_clothes = [ - "Solidus T-Shirt", "Solidus Long Sleeve", "Solidus Women's T-Shirt" -] +solidus_cap = Spree::Product.find_by!(name: "Solidus cap") -Spree::Product.all.find_each do |product| - product.option_types = [size] - product.option_types << color if colored_clothes.include?(product.name) - product.save! -end +solidus_cap.option_types = [size, color] +solidus_cap.save! + +solidus_hoodie = Spree::Product.find_by!(name: "Solidus hoodie") + +solidus_hoodie.option_types = [size, color] +solidus_hoodie.save! diff --git a/sample/db/samples/product_properties.rb b/sample/db/samples/product_properties.rb index c68125292fe..f58aedc9b71 100644 --- a/sample/db/samples/product_properties.rb +++ b/sample/db/samples/product_properties.rb @@ -2,50 +2,50 @@ products = { - "Solidus Tote" => + "Solidus tote" => { "Type" => "Tote", "Size" => %{15" x 18" x 6"}, "Material" => "Canvas" }, - "Ruby Tote" => + "Solidus canvas tote bag" => { "Type" => "Tote", "Size" => %{15" x 18" x 6"}, "Material" => "Canvas" }, - "Solidus Snapback Cap" => + "Solidus cap" => { - "Type" => "Snapback Cap", + "Type" => "Cap", "Size" => "One Size", "Material" => "100% Cotton" }, - "Solidus T-Shirt" => + "Solidus dark tee" => { "Manufacturer" => "Jerseys", - "Brand" => "Conditioned", + "Brand" => "Solidus", "Model" => "TL9002", "Shirt Type" => "Ringer T", "Sleeve Type" => "Short", "Made from" => "100% Cotton", "Fit" => "Loose", - "Gender" => "Men's" + "Gender" => "Unisex" }, - "Solidus Long Sleeve" => + "Solidus t-shirt" => { "Manufacturer" => "Wilson", - "Brand" => "Wannabe Sports", + "Brand" => "Solidus", "Model" => "TL9002", "Shirt Type" => "Jersey", "Sleeve Type" => "Long", "Made from" => "100% cotton", "Fit" => "Loose", - "Gender" => "Men's" + "Gender" => "Unisex" }, - "Solidus Hoodie Zip" => + "Solidus hoodie" => { "Manufacturer" => "Jerseys", - "Brand" => "Wannabe Sports", + "Brand" => "Solidus", "Model" => "HD9001", "Shirt Type" => "Jersey", "Sleeve Type" => "Long", @@ -53,10 +53,10 @@ "Fit" => "Loose", "Gender" => "Unisex" }, - "Ruby Hoodie" => + "Solidus long sleeve tee" => { "Manufacturer" => "Wilson", - "Brand" => "Resiliance", + "Brand" => "Solidus", "Model" => "HD2001", "Shirt Type" => "Baseball", "Sleeve Type" => "Long", @@ -64,48 +64,10 @@ "Fit" => "Loose", "Gender" => "Unisex" }, - "Ruby Hoodie Zip" => + "Solidus Water Bottle" => { - "Manufacturer" => "Jerseys", - "Brand" => "Wannabe Sports", - "Model" => "HD9001", - "Shirt Type" => "Jersey", - "Sleeve Type" => "Long", - "Made from" => "100% cotton", - "Fit" => "Loose", - "Gender" => "Unisex" - }, - "Ruby Polo" => - { - "Manufacturer" => "Wilson", - "Brand" => "Resiliance", - "Model" => "PL9001", - "Shirt Type" => "Ringer T", - "Sleeve Type" => "Short", - "Made from" => "100% Cotton", - "Fit" => "Slim", - "Gender" => "Men's" - }, - "Solidus Mug" => - { - "Type" => "Mug", - "Size" => %{4.5" tall, 3.25" dia.} - }, - "Ruby Mug" => - { - "Type" => "Mug", + "Type" => "Insulated Water Bottle", "Size" => %{4.5" tall, 3.25" dia.} - }, - "Solidus Women's T-Shirt" => - { - "Manufacturer" => "Jerseys", - "Brand" => "Conditioned", - "Model" => "WM6001", - "Shirt Type" => "Skinny", - "Sleeve Type" => "Short", - "Made from" => "90% Cotton, 10% Nylon", - "Fit" => "Slim", - "Gender" => "Women's" } } diff --git a/sample/db/samples/products.rb b/sample/db/samples/products.rb index 3c5dd345419..7737c609157 100644 --- a/sample/db/samples/products.rb +++ b/sample/db/samples/products.rb @@ -22,7 +22,7 @@ products = [ { - name: "Solidus T-Shirt", + name: "Solidus Water Bottle", tax_category: tax_category, shipping_category: shipping_category, price: 19.99, @@ -30,10 +30,10 @@ weight: 0.5, height: 20, width: 10, - depth: 5 + depth: 5, }, { - name: "Solidus Long Sleeve", + name: "Solidus tote", tax_category: tax_category, shipping_category: shipping_category, price: 19.99, @@ -41,43 +41,32 @@ weight: 0.5, height: 20, width: 10, - depth: 5 + depth: 5, }, { - name: "Solidus Women's T-Shirt", + name: "Solidus hoodie", tax_category: tax_category, shipping_category: shipping_category, - price: 19.99, - eur_price: 16, - weight: 0.5, + price: 29.99, + eur_price: 27, + weight: 1, height: 20, width: 10, - depth: 5 + depth: 5, }, { - name: "Solidus Snapback Cap", + name: "Solidus mug set", tax_category: tax_category, shipping_category: shipping_category, - price: 15.99, - eur_price: 14, + price: 19.99, + eur_price: 16, weight: 0.5, - height: 5, - width: 5, - depth: 5 - }, - { - name: "Solidus Hoodie Zip", - tax_category: tax_category, - shipping_category: shipping_category, - price: 29.99, - eur_price: 27, - weight: 1, height: 20, width: 10, depth: 5 }, { - name: "Ruby Hoodie", + name: "Solidus winter hat", tax_category: tax_category, shipping_category: shipping_category, price: 29.99, @@ -88,7 +77,7 @@ depth: 5 }, { - name: "Ruby Hoodie Zip", + name: "Solidus circle sticker", tax_category: tax_category, shipping_category: shipping_category, price: 29.99, @@ -99,7 +88,7 @@ depth: 5 }, { - name: "Ruby Polo", + name: "Solidus notebook", tax_category: tax_category, shipping_category: shipping_category, price: 26.99, @@ -110,7 +99,7 @@ depth: 5 }, { - name: "Solidus Mug", + name: "Solidus t-shirt", tax_category: tax_category, shipping_category: shipping_category, price: 9.99, @@ -121,18 +110,18 @@ depth: 5 }, { - name: "Ruby Mug", + name: "Solidus long sleeve tee", tax_category: tax_category, shipping_category: shipping_category, - price: 9.99, - eur_price: 7, - weight: 1, - height: 5, - width: 5, + price: 15.99, + eur_price: 14, + weight: 0.5, + height: 20, + width: 10, depth: 5 }, { - name: "Solidus Tote", + name: "Solidus dark tee", tax_category: tax_category, shipping_category: shipping_category, price: 15.99, @@ -143,7 +132,7 @@ depth: 5 }, { - name: "Ruby Tote", + name: "Solidus canvas tote bag", tax_category: tax_category, shipping_category: shipping_category, price: 15.99, @@ -152,6 +141,18 @@ height: 20, width: 10, depth: 5 + }, + { + name: "Solidus cap", + description: "Step into style with our signature cap – a perfect blend of comfort and trendsetting flair. Crafted with care and designed for the fashion-forward, this cap adds an instant touch of cool to any outfit. Whether you're hitting the streets or simply seeking shade, our cap is your go-to accessory. Elevate your look today!", + tax_category: tax_category, + shipping_category: shipping_category, + price: 24, + eur_price: 22, + weight: 0.5, + height: 20, + width: 10, + depth: 5 } ] diff --git a/sample/db/samples/taxons.rb b/sample/db/samples/taxons.rb index e7121715f5c..59176e318f3 100644 --- a/sample/db/samples/taxons.rb +++ b/sample/db/samples/taxons.rb @@ -4,21 +4,20 @@ Spree::Sample.load_sample("products") categories = Spree::Taxonomy.find_by!(name: "Categories") -brands = Spree::Taxonomy.find_by!(name: "Brand") products = { - solidus_tshirt: "Solidus T-Shirt", - solidus_long: "Solidus Long Sleeve", - solidus_tote: "Solidus Tote", - ruby_tote: "Ruby Tote", - solidus_snapback_cap: "Solidus Snapback Cap", - solidus_hoodie: "Solidus Hoodie Zip", - ruby_hoodie: "Ruby Hoodie", - ruby_hoodie_zip: "Ruby Hoodie Zip", - ruby_polo: "Ruby Polo", - solidus_mug: "Solidus Mug", - ruby_mug: "Ruby Mug", - solidus_womens_tshirt: "Solidus Women's T-Shirt" + solidus_bottles: "Solidus Water Bottle", + solidus_tote: "Solidus tote", + solidus_hoodie: "Solidus hoodie", + solidus_mug_set: "Solidus mug set", + solidus_hat: "Solidus winter hat", + solidus_sticker: "Solidus circle sticker", + solidus_notebook: "Solidus notebook", + solidus_tshirt: "Solidus t-shirt", + solidus_long_sleeve_tee: "Solidus long sleeve tee", + solidus_dark_tee: "Solidus dark tee", + solidus_canvas_tote: "Solidus canvas tote bag", + solidus_cap: "Solidus cap" } products.each do |key, name| @@ -36,49 +35,42 @@ parent: "Categories" }, { - name: "Caps", + name: "Accessories", taxonomy: categories, - parent: "Categories", - products: [ - products[:solidus_snapback_cap] - ] + parent: "Categories" }, { - name: "Bags", + name: "Stickers", taxonomy: categories, parent: "Categories", products: [ - products[:solidus_tote], - products[:ruby_tote] + products[:solidus_sticker] ] }, { - name: "Mugs", + name: "Caps", taxonomy: categories, - parent: "Categories", + parent: "Clothing", products: [ - products[:solidus_mug], - products[:ruby_mug] + products[:solidus_hat], + products[:solidus_cap] ] }, { - name: "Shirts", + name: "Totes", taxonomy: categories, - parent: "Clothing", + parent: "Accessories", products: [ - products[:solidus_long], - products[:ruby_polo], - products[:solidus_womens_tshirt] + products[:solidus_tote], + products[:solidus_canvas_tote] ] }, { - name: "Hoodie", + name: "Water Bottles", taxonomy: categories, - parent: "Clothing", + parent: "Accessories", products: [ - products[:solidus_hoodie], - products[:ruby_hoodie], - products[:ruby_hoodie_zip] + products[:solidus_bottles], ] }, { @@ -86,37 +78,17 @@ taxonomy: categories, parent: "Clothing", products: [ - products[:solidus_tshirt] + products[:solidus_tshirt], + products[:solidus_dark_tee], + products[:solidus_long_sleeve_tee] ], }, { - name: "Brands", - taxonomy: brands - }, - { - name: "Solidus", - taxonomy: brands, - parent: "Brand", + name: "Hoodies", + taxonomy: categories, + parent: "Clothing", products: [ - products[:solidus_tshirt], - products[:solidus_long], - products[:solidus_snapback_cap], products[:solidus_hoodie], - products[:solidus_mug], - products[:solidus_tote], - products[:solidus_womens_tshirt] - ] - }, - { - name: "Ruby", - taxonomy: brands, - parent: "Brand", - products: [ - products[:ruby_hoodie], - products[:ruby_hoodie_zip], - products[:ruby_polo], - products[:ruby_mug], - products[:ruby_tote] ] } ] diff --git a/sample/db/samples/variants.rb b/sample/db/samples/variants.rb index 9da88b04654..662b50f5be3 100644 --- a/sample/db/samples/variants.rb +++ b/sample/db/samples/variants.rb @@ -3,18 +3,18 @@ Spree::Sample.load_sample("option_values") Spree::Sample.load_sample("products") -solidus_tshirt = Spree::Product.find_by!(name: "Solidus T-Shirt") -solidus_long = Spree::Product.find_by!(name: "Solidus Long Sleeve") -solidus_snapback_cap = Spree::Product.find_by!(name: "Solidus Snapback Cap") -solidus_hoodie = Spree::Product.find_by!(name: "Solidus Hoodie Zip") -ruby_hoodie = Spree::Product.find_by!(name: "Ruby Hoodie") -ruby_hoodie_zip = Spree::Product.find_by!(name: "Ruby Hoodie Zip") -ruby_polo = Spree::Product.find_by!(name: "Ruby Polo") -solidus_mug = Spree::Product.find_by!(name: "Solidus Mug") -ruby_mug = Spree::Product.find_by!(name: "Ruby Mug") -solidus_tote = Spree::Product.find_by!(name: "Solidus Tote") -ruby_tote = Spree::Product.find_by!(name: "Ruby Tote") -solidus_womens_tshirt = Spree::Product.find_by!(name: "Solidus Women's T-Shirt") +solidus_bottles = Spree::Product.find_by!(name: "Solidus Water Bottle") +solidus_tote = Spree::Product.find_by!(name: "Solidus tote") +solidus_hoodie = Spree::Product.find_by!(name: "Solidus hoodie") +solidus_mug_set = Spree::Product.find_by!(name: "Solidus mug set") +solidus_hat = Spree::Product.find_by!(name: "Solidus winter hat") +solidus_sticker = Spree::Product.find_by!(name: "Solidus circle sticker") +solidus_notebook = Spree::Product.find_by!(name: "Solidus notebook") +solidus_tshirt = Spree::Product.find_by!(name: "Solidus t-shirt") +solidus_long_sleeve_tee = Spree::Product.find_by!(name: "Solidus long sleeve tee") +solidus_dark_tee = Spree::Product.find_by!(name: "Solidus dark tee") +solidus_canvas_tote = Spree::Product.find_by!(name: "Solidus canvas tote bag") +solidus_cap = Spree::Product.find_by!(name: "Solidus cap") small = Spree::OptionValue.find_by!(name: "Small") medium = Spree::OptionValue.find_by!(name: "Medium") @@ -23,281 +23,302 @@ blue = Spree::OptionValue.find_by!(name: "Blue") black = Spree::OptionValue.find_by!(name: "Black") -white = Spree::OptionValue.find_by!(name: "White") +gray = Spree::OptionValue.find_by!(name: "Gray") +red = Spree::OptionValue.find_by!(name: "Red") variants = [ { - product: solidus_tshirt, - option_values: [small, blue], - sku: "SOL-00003", + product: solidus_hoodie, + option_values: [small, black], + sku: "SOL-HOODIE-04", cost_price: 17 }, { - product: solidus_tshirt, - option_values: [small, black], - sku: "SOL-00002", + product: solidus_hoodie, + option_values: [medium, black], + sku: "SOL-HOODIE-05", cost_price: 17 }, { - product: solidus_tshirt, - option_values: [small, white], - sku: "SOL-00004", + product: solidus_hoodie, + option_values: [large, black], + sku: "SOL-HOODIE-07", cost_price: 17 }, { - product: solidus_tshirt, - option_values: [medium, blue], - sku: "SOL-00005", + product: solidus_hoodie, + option_values: [extra_large, black], + sku: "SOL-HOODIE-06", cost_price: 17 }, { - product: solidus_tshirt, - option_values: [large, white], - sku: "SOL-00006", + product: solidus_hoodie, + option_values: [small, red], + sku: "SOL-HOODIE-01", cost_price: 17 }, { - product: solidus_tshirt, - option_values: [large, black], - sku: "SOL-00007", + product: solidus_hoodie, + option_values: [medium, red], + sku: "SOL-HOODIE-02", cost_price: 17 }, { - product: solidus_tshirt, - option_values: [extra_large, blue], - sku: "SOL-0008", + product: solidus_hoodie, + option_values: [large, red], + sku: "SOL-HOODIE-08", cost_price: 17 }, { - product: solidus_long, - option_values: [small, black], - sku: "SOL-LS02", + product: solidus_hoodie, + option_values: [extra_large, red], + sku: "SOL-HOODIE-03", cost_price: 17 }, { - product: solidus_long, - option_values: [small, white], - sku: "SOL-LS01", - cost_price: 17 + product: solidus_tshirt, + option_values: [medium, black], + sku: "SOL-TEE-01", + cost_price: 8.9 + }, + { + product: solidus_tshirt, + option_values: [large, black], + sku: "SOL-TEE-02", + cost_price: 9.9 + }, + { + product: solidus_tshirt, + option_values: [extra_large, black], + sku: "SOL-TEE-03", + cost_price: 11.9 }, { - product: solidus_long, - option_values: [small, blue], - sku: "SOL-LS03", + product: solidus_tote, + option_values: [small, red], + sku: "SOL-0000", cost_price: 17 }, { - product: solidus_long, - option_values: [medium, white], - sku: "SOL-LS04", + product: solidus_tote, + option_values: [large, red], + sku: "SOL-0001", cost_price: 17 }, { - product: solidus_long, - option_values: [medium, black], - sku: "SOL-LS05", + product: solidus_tote, + option_values: [extra_large, red], + sku: "SOL-0002", cost_price: 17 }, { - product: solidus_long, - option_values: [medium, blue], - sku: "SOL-LS06", + product: solidus_bottles, + option_values: [small, gray], + sku: "SOL-0011", cost_price: 17 }, { - product: solidus_long, - option_values: [large, white], - sku: "SOL-LS07", + product: solidus_bottles, + option_values: [medium, gray], + sku: "SOL-0012", cost_price: 17 }, { - product: solidus_long, - option_values: [large, black], - sku: "SOL-LS08", + product: solidus_bottles, + option_values: [large, gray], + sku: "SOL-0013", cost_price: 17 }, { - product: solidus_long, - option_values: [large, blue], - sku: "SOL-LS09", + product: solidus_bottles, + option_values: [extra_large, gray], + sku: "SOL-0014", cost_price: 17 }, { - product: solidus_womens_tshirt, + product: solidus_cap, option_values: [small, black], - sku: "SOL-WM001", - cost_price: 17 + sku: "SOL-HD001", + cost_price: 27 }, { - product: solidus_womens_tshirt, - option_values: [small, blue], - sku: "SOL-WM002", - cost_price: 17 + product: solidus_cap, + option_values: [small, gray], + sku: "SOL-HD002", + cost_price: 27 }, { - product: solidus_womens_tshirt, - option_values: [small, white], - sku: "SOL-WM003", - cost_price: 17 + product: solidus_cap, + option_values: [medium, black], + sku: "SOL-HD003", + cost_price: 27 }, { - product: solidus_womens_tshirt, - option_values: [medium, blue], - sku: "SOL-WM004", - cost_price: 17 + product: solidus_cap, + option_values: [medium, gray], + sku: "SOL-HD004", + cost_price: 27 }, { - product: solidus_womens_tshirt, - option_values: [medium, white], - sku: "SOL-WM005", - cost_price: 17 + product: solidus_cap, + option_values: [large, black], + sku: "SOL-HD005", + cost_price: 27 }, { - product: solidus_womens_tshirt, - option_values: [medium, black], - sku: "SOL-WM006", - cost_price: 17 + product: solidus_cap, + option_values: [extra_large, black], + sku: "SOL-HD045", + cost_price: 27 }, { - product: solidus_snapback_cap, - option_values: [small], - sku: "SOL-SNC02", - cost_price: 17 + product: solidus_cap, + option_values: [large, gray], + sku: "SOL-HD006", + cost_price: 27 }, { - product: solidus_snapback_cap, - option_values: [medium], - sku: "SOL-SNC03", - cost_price: 17 + product: solidus_cap, + option_values: [small, red], + sku: "SOL-HD007", + cost_price: 27 }, { - product: solidus_snapback_cap, - option_values: [large], - sku: "SOL-SNC04", - cost_price: 17 + product: solidus_cap, + option_values: [medium, red], + sku: "SOL-HD008", + cost_price: 27 }, { - product: solidus_hoodie, - option_values: [small], - sku: "SOL-HD02", + product: solidus_cap, + option_values: [large, red], + sku: "SOL-HD009", cost_price: 27 }, { - product: solidus_hoodie, - option_values: [medium], - sku: "SOL-HD03", + product: solidus_cap, + option_values: [extra_large, red], + sku: "SOL-HD010", cost_price: 27 }, { - product: solidus_hoodie, - option_values: [large], - sku: "SOL-HD04", + product: solidus_mug_set, + option_values: [small, gray], + sku: "SOL-HD011", cost_price: 27 }, { - product: ruby_hoodie, - option_values: [small], - sku: "RUB-HD02", + product: solidus_mug_set, + option_values: [medium, gray], + sku: "SOL-HD012", cost_price: 27 }, { - product: ruby_hoodie, - option_values: [medium], - sku: "RUB-HD03", + product: solidus_mug_set, + option_values: [extra_large, gray], + sku: "SOL-HD013", cost_price: 27 }, { - product: ruby_hoodie, - option_values: [large], - sku: "RUB-HD04", + product: solidus_mug_set, + option_values: [small, black], + sku: "SOL-HD014", cost_price: 27 }, { - product: ruby_hoodie_zip, - option_values: [small], - sku: "RUB-HD05", + product: solidus_mug_set, + option_values: [medium, black], + sku: "SOL-HD015", cost_price: 27 }, { - product: ruby_hoodie_zip, - option_values: [medium], - sku: "RUB-HD06", + product: solidus_mug_set, + option_values: [large, black], + sku: "SOL-HD016", cost_price: 27 }, { - product: ruby_hoodie_zip, - option_values: [large], - sku: "RUB-HD07", + product: solidus_mug_set, + option_values: [extra_large, black], + sku: "SOL-HD017", cost_price: 27 }, { - product: ruby_polo, - option_values: [small], - sku: "RUB-PL02", - cost_price: 23 + product: solidus_mug_set, + option_values: [large, blue], + sku: "SOL-HD018", + cost_price: 27 }, { - product: ruby_polo, - option_values: [medium], - sku: "RUB-PL03", - cost_price: 23 + product: solidus_mug_set, + option_values: [medium, blue], + sku: "SOL-HD019", + cost_price: 27 }, { - product: ruby_polo, - option_values: [large], - sku: "RUB-PL04", - cost_price: 23 + product: solidus_mug_set, + option_values: [extra_large, blue], + sku: "SOL-HD020", + cost_price: 27 } ] masters = { - solidus_tote => { - sku: "SOL-TOT01", - cost_price: 17 - }, - ruby_tote => { - sku: "RUB-TOT01", - cost_price: 17 - }, - solidus_snapback_cap => { - sku: "SOL-SNC01", + solidus_hoodie => { + sku: "SOL-HOODIE-00", cost_price: 17 }, - solidus_tshirt => { + solidus_bottles => { sku: "SOL-00001", cost_price: 17 }, - solidus_long => { - sku: "SOL-LS00", + solidus_tote => { + sku: "SOL-LG001", cost_price: 17 }, - solidus_hoodie => { - sku: "SOL-HD00", + solidus_mug_set => { + sku: "SOL-LGH01", cost_price: 27 }, - ruby_hoodie => { - sku: "RUB-HD01", + solidus_hat => { + sku: "SOL-MNH01", cost_price: 27 }, - ruby_hoodie_zip => { - sku: "RUB-HD00", + solidus_sticker => { + sku: "RUB-HDH01", cost_price: 27 }, - ruby_polo => { - sku: "RUB-PL01", - cost_price: 23 + solidus_tote => { + sku: "SOL-TOT01", + cost_price: 17 + }, + solidus_tote => { + sku: "RUB-TOT01", + cost_price: 17 + }, + solidus_notebook => { + sku: "SOL-SNC01", + cost_price: 17 + }, + solidus_tshirt => { + sku: "RUB-SNC02", + cost_price: 17 }, - solidus_mug => { + solidus_long_sleeve_tee => { sku: "SOL-MG01", cost_price: 7 }, - ruby_mug => { + solidus_dark_tee => { sku: "RUB-MG01", cost_price: 7 }, - solidus_womens_tshirt => { - sku: "SOL-WM00", - cost_price: 17 + solidus_canvas_tote => { + sku: "SOL-TTE99", + cost_price: 19 + }, + solidus_cap => { + sku: "SOL-CAP99", + cost_price: 24, } }