diff --git a/core/app/models/spree/image/paperclip_attachment.rb b/core/app/models/spree/image/paperclip_attachment.rb index b716824d8b6..2733fdce219 100644 --- a/core/app/models/spree/image/paperclip_attachment.rb +++ b/core/app/models/spree/image/paperclip_attachment.rb @@ -7,7 +7,7 @@ module Spree::Image::PaperclipAttachment validate :no_attachment_errors has_attached_file :attachment, - styles: { mini: '48x48>', small: '100x100>', product: '240x240>', large: '600x600>' }, + styles: { mini: '48x48>', small: '400x400>', product: '680x680>', large: '1200x1200>' }, default_style: :product, default_url: 'noimage/:style.png', url: '/spree/products/:id/:style/:basename.:extension', diff --git a/sample/db/samples/assets.rb b/sample/db/samples/assets.rb index 685cd42c63b..9fcf3c47add 100644 --- a/sample/db/samples/assets.rb +++ b/sample/db/samples/assets.rb @@ -4,17 +4,20 @@ Spree::Sample.load_sample("variants") products = {} -products[:ror_baseball_jersey] = Spree::Product.find_by!(name: "Ruby on Rails Baseball Jersey") -products[:ror_tote] = Spree::Product.find_by!(name: "Ruby on Rails Tote") -products[:ror_bag] = Spree::Product.find_by!(name: "Ruby on Rails Bag") -products[:ror_jr_spaghetti] = Spree::Product.find_by!(name: "Ruby on Rails Jr. Spaghetti") -products[:ror_mug] = Spree::Product.find_by!(name: "Ruby on Rails Mug") -products[:ror_ringer] = Spree::Product.find_by!(name: "Ruby on Rails Ringer T-Shirt") -products[:ror_stein] = Spree::Product.find_by!(name: "Ruby on Rails Stein") -products[:ruby_baseball_jersey] = Spree::Product.find_by!(name: "Ruby Baseball Jersey") -products[:apache_baseball_jersey] = Spree::Product.find_by!(name: "Apache Baseball Jersey") +products[:solidus_tshirt] = Spree::Product.find_by!(name: "Solidus T-Shirt") +products[:solidus_long] = Spree::Product.find_by!(name: "Solidus Long Sleeve") +products[:solidus_girly] = Spree::Product.find_by!(name: "Solidus Girly") +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") -def image(name, type = "jpeg") +def image(name, type = "jpg") images_path = Pathname.new(File.dirname(__FILE__)) + "images" path = images_path + "#{name}.#{type}" return false if !File.exist?(path) @@ -22,81 +25,111 @@ def image(name, type = "jpeg") end images = { - products[:ror_tote].master => [ + products[:solidus_tshirt].master => [ { - attachment: image("ror_tote") + attachment: image("solidus_tshirt") }, { - attachment: image("ror_tote_back") + attachment: image("solidus_tshirt_back") } ], - products[:ror_bag].master => [ + products[:solidus_long].master => [ { - attachment: image("ror_bag") + attachment: image("solidus_long") + }, + { + attachment: image("solidus_long_back") } ], - products[:ror_baseball_jersey].master => [ - { - attachment: image("ror_baseball") - }, + products[:solidus_snapback_cap].master => [ { - attachment: image("ror_baseball_back") + attachment: image("solidus_snapback_cap") } ], - products[:ror_jr_spaghetti].master => [ + products[:solidus_hoodie].master => [ { - attachment: image("ror_jr_spaghetti") + attachment: image("solidus_hoodie") } ], - products[:ror_mug].master => [ + products[:ruby_hoodie].master => [ { - attachment: image("ror_mug") - }, + attachment: image("ruby_hoodie") + } + ], + products[:ruby_hoodie_zip].master => [ { - attachment: image("ror_mug_back") + attachment: image("ruby_hoodie_zip") } ], - products[:ror_ringer].master => [ + products[:ruby_polo].master => [ { - attachment: image("ror_ringer") + attachment: image("ruby_polo") }, { - attachment: image("ror_ringer_back") + attachment: image("ruby_polo_back") } ], - products[:ror_stein].master => [ + products[:solidus_mug].master => [ { - attachment: image("ror_stein") - }, + attachment: image("solidus_mug") + } + ], + products[:ruby_mug].master => [ { - attachment: image("ror_stein_back") + attachment: image("ruby_mug") } ], - products[:apache_baseball_jersey].master => [ + products[:solidus_tote].master => [ { - attachment: image("apache_baseball", "png") + attachment: image("tote_bag_solidus") } ], - products[:ruby_baseball_jersey].master => [ + products[:ruby_tote].master => [ { - attachment: image("ruby_baseball", "png") + attachment: image("tote_bag_ruby") + } + ], + products[:solidus_girly].master => [ + { + attachment: image("solidus_girly") } ] } -products[:ror_baseball_jersey].variants.each do |variant| +products[:solidus_tshirt].variants.each do |variant| color = variant.option_value("tshirt-color").downcase - main_image = image("ror_baseball_jersey_#{color}", "png") + main_image = image("solidus_tshirt_#{color}", "png") File.open(main_image) do |f| variant.images.create!(attachment: f) end - back_image = image("ror_baseball_jersey_back_#{color}", "png") + back_image = image("solidus_tshirt_back_#{color}", "png") next unless back_image File.open(back_image) do |f| variant.images.create!(attachment: f) end end +products[:solidus_long].variants.each do |variant| + color = variant.option_value("tshirt-color").downcase + main_image = image("solidus_long_#{color}", "png") + File.open(main_image) do |f| + variant.images.create!(attachment: f) + end + back_image = image("solidus_long_back_#{color}", "png") + next unless back_image + File.open(back_image) do |f| + variant.images.create!(attachment: f) + end +end + +products[:solidus_girly].variants.each do |variant| + color = variant.option_value("tshirt-color").downcase + main_image = image("solidus_girly_#{color}", "png") + File.open(main_image) do |f| + variant.images.create!(attachment: f) + end +end + images.each do |variant, attachments| puts "Loading images for #{variant.product.name}" attachments.each do |attachment| diff --git a/sample/db/samples/images/ror_bag.jpeg b/sample/db/samples/images/ror_bag.jpg similarity index 100% rename from sample/db/samples/images/ror_bag.jpeg rename to sample/db/samples/images/ror_bag.jpg diff --git a/sample/db/samples/images/ror_baseball.jpeg b/sample/db/samples/images/ror_baseball.jpg similarity index 100% rename from sample/db/samples/images/ror_baseball.jpeg rename to sample/db/samples/images/ror_baseball.jpg diff --git a/sample/db/samples/images/ror_baseball_back.jpeg b/sample/db/samples/images/ror_baseball_back.jpg similarity index 100% rename from sample/db/samples/images/ror_baseball_back.jpeg rename to sample/db/samples/images/ror_baseball_back.jpg diff --git a/sample/db/samples/images/ror_jr_spaghetti.jpeg b/sample/db/samples/images/ror_jr_spaghetti.jpg similarity index 100% rename from sample/db/samples/images/ror_jr_spaghetti.jpeg rename to sample/db/samples/images/ror_jr_spaghetti.jpg diff --git a/sample/db/samples/images/ror_mug.jpeg b/sample/db/samples/images/ror_mug.jpg similarity index 100% rename from sample/db/samples/images/ror_mug.jpeg rename to sample/db/samples/images/ror_mug.jpg diff --git a/sample/db/samples/images/ror_mug_back.jpeg b/sample/db/samples/images/ror_mug_back.jpg similarity index 100% rename from sample/db/samples/images/ror_mug_back.jpeg rename to sample/db/samples/images/ror_mug_back.jpg diff --git a/sample/db/samples/images/ror_ringer.jpeg b/sample/db/samples/images/ror_ringer.jpg similarity index 100% rename from sample/db/samples/images/ror_ringer.jpeg rename to sample/db/samples/images/ror_ringer.jpg diff --git a/sample/db/samples/images/ror_ringer_back.jpeg b/sample/db/samples/images/ror_ringer_back.jpg similarity index 100% rename from sample/db/samples/images/ror_ringer_back.jpeg rename to sample/db/samples/images/ror_ringer_back.jpg diff --git a/sample/db/samples/images/ror_stein.jpeg b/sample/db/samples/images/ror_stein.jpg similarity index 100% rename from sample/db/samples/images/ror_stein.jpeg rename to sample/db/samples/images/ror_stein.jpg diff --git a/sample/db/samples/images/ror_stein_back.jpeg b/sample/db/samples/images/ror_stein_back.jpg similarity index 100% rename from sample/db/samples/images/ror_stein_back.jpeg rename to sample/db/samples/images/ror_stein_back.jpg diff --git a/sample/db/samples/images/ror_tote.jpeg b/sample/db/samples/images/ror_tote.jpg similarity index 100% rename from sample/db/samples/images/ror_tote.jpeg rename to sample/db/samples/images/ror_tote.jpg diff --git a/sample/db/samples/images/ror_tote_back.jpeg b/sample/db/samples/images/ror_tote_back.jpg similarity index 100% rename from sample/db/samples/images/ror_tote_back.jpeg rename to sample/db/samples/images/ror_tote_back.jpg diff --git a/sample/db/samples/images/ruby_hoodie.jpg b/sample/db/samples/images/ruby_hoodie.jpg new file mode 100644 index 00000000000..93cc253c64b Binary files /dev/null and b/sample/db/samples/images/ruby_hoodie.jpg differ diff --git a/sample/db/samples/images/ruby_hoodie_zip.jpg b/sample/db/samples/images/ruby_hoodie_zip.jpg new file mode 100644 index 00000000000..98c5a75c2b7 Binary files /dev/null and b/sample/db/samples/images/ruby_hoodie_zip.jpg differ diff --git a/sample/db/samples/images/ruby_mug.jpg b/sample/db/samples/images/ruby_mug.jpg new file mode 100644 index 00000000000..87fd3950179 Binary files /dev/null and b/sample/db/samples/images/ruby_mug.jpg differ diff --git a/sample/db/samples/images/ruby_polo.jpg b/sample/db/samples/images/ruby_polo.jpg new file mode 100644 index 00000000000..bc910c99eea Binary files /dev/null and b/sample/db/samples/images/ruby_polo.jpg differ diff --git a/sample/db/samples/images/ruby_polo_back.jpg b/sample/db/samples/images/ruby_polo_back.jpg new file mode 100644 index 00000000000..b5b5703f18c Binary files /dev/null and b/sample/db/samples/images/ruby_polo_back.jpg differ diff --git a/sample/db/samples/images/solidus_girly.jpg b/sample/db/samples/images/solidus_girly.jpg new file mode 100644 index 00000000000..320fd7b1aae Binary files /dev/null and b/sample/db/samples/images/solidus_girly.jpg differ diff --git a/sample/db/samples/images/solidus_girly_black.png b/sample/db/samples/images/solidus_girly_black.png new file mode 100644 index 00000000000..9c2fd15b8c3 Binary files /dev/null and b/sample/db/samples/images/solidus_girly_black.png differ diff --git a/sample/db/samples/images/solidus_girly_blue.png b/sample/db/samples/images/solidus_girly_blue.png new file mode 100644 index 00000000000..cbb8b17ec93 Binary files /dev/null and b/sample/db/samples/images/solidus_girly_blue.png differ diff --git a/sample/db/samples/images/solidus_girly_white.png b/sample/db/samples/images/solidus_girly_white.png new file mode 100644 index 00000000000..e7bd747e4b2 Binary files /dev/null and b/sample/db/samples/images/solidus_girly_white.png differ diff --git a/sample/db/samples/images/solidus_hoodie.jpg b/sample/db/samples/images/solidus_hoodie.jpg new file mode 100644 index 00000000000..8bf8d645de1 Binary files /dev/null and b/sample/db/samples/images/solidus_hoodie.jpg differ diff --git a/sample/db/samples/images/solidus_long.jpg b/sample/db/samples/images/solidus_long.jpg new file mode 100644 index 00000000000..d6586d9dc6b Binary files /dev/null and b/sample/db/samples/images/solidus_long.jpg differ diff --git a/sample/db/samples/images/solidus_long_back.jpg b/sample/db/samples/images/solidus_long_back.jpg new file mode 100644 index 00000000000..0736a71c29f Binary files /dev/null and b/sample/db/samples/images/solidus_long_back.jpg differ diff --git a/sample/db/samples/images/solidus_long_back_black.png b/sample/db/samples/images/solidus_long_back_black.png new file mode 100644 index 00000000000..b3d929ccba3 Binary files /dev/null and b/sample/db/samples/images/solidus_long_back_black.png differ diff --git a/sample/db/samples/images/solidus_long_back_blue.png b/sample/db/samples/images/solidus_long_back_blue.png new file mode 100644 index 00000000000..7b4e9b99792 Binary files /dev/null and b/sample/db/samples/images/solidus_long_back_blue.png differ diff --git a/sample/db/samples/images/solidus_long_back_white.png b/sample/db/samples/images/solidus_long_back_white.png new file mode 100644 index 00000000000..d6c9e9b89ef Binary files /dev/null and b/sample/db/samples/images/solidus_long_back_white.png differ diff --git a/sample/db/samples/images/solidus_long_black.png b/sample/db/samples/images/solidus_long_black.png new file mode 100644 index 00000000000..277792ab100 Binary files /dev/null and b/sample/db/samples/images/solidus_long_black.png differ diff --git a/sample/db/samples/images/solidus_long_blue.png b/sample/db/samples/images/solidus_long_blue.png new file mode 100644 index 00000000000..7bbd1d7491e Binary files /dev/null and b/sample/db/samples/images/solidus_long_blue.png differ diff --git a/sample/db/samples/images/solidus_long_white.png b/sample/db/samples/images/solidus_long_white.png new file mode 100644 index 00000000000..4446fc81915 Binary files /dev/null and b/sample/db/samples/images/solidus_long_white.png differ diff --git a/sample/db/samples/images/solidus_mug.jpg b/sample/db/samples/images/solidus_mug.jpg new file mode 100644 index 00000000000..3c4f16a1c5f Binary files /dev/null and b/sample/db/samples/images/solidus_mug.jpg differ diff --git a/sample/db/samples/images/solidus_snapback_cap.jpg b/sample/db/samples/images/solidus_snapback_cap.jpg new file mode 100644 index 00000000000..0ecae576f70 Binary files /dev/null and b/sample/db/samples/images/solidus_snapback_cap.jpg differ diff --git a/sample/db/samples/images/solidus_tshirt.jpg b/sample/db/samples/images/solidus_tshirt.jpg new file mode 100644 index 00000000000..dec576acdff Binary files /dev/null and b/sample/db/samples/images/solidus_tshirt.jpg differ diff --git a/sample/db/samples/images/solidus_tshirt_back.jpg b/sample/db/samples/images/solidus_tshirt_back.jpg new file mode 100644 index 00000000000..44c076e69ed Binary files /dev/null and b/sample/db/samples/images/solidus_tshirt_back.jpg differ diff --git a/sample/db/samples/images/solidus_tshirt_back_black.png b/sample/db/samples/images/solidus_tshirt_back_black.png new file mode 100644 index 00000000000..2f325dd709f Binary files /dev/null and b/sample/db/samples/images/solidus_tshirt_back_black.png differ diff --git a/sample/db/samples/images/solidus_tshirt_back_blue.png b/sample/db/samples/images/solidus_tshirt_back_blue.png new file mode 100644 index 00000000000..6d11da372ee Binary files /dev/null and b/sample/db/samples/images/solidus_tshirt_back_blue.png differ diff --git a/sample/db/samples/images/solidus_tshirt_back_white.png b/sample/db/samples/images/solidus_tshirt_back_white.png new file mode 100644 index 00000000000..890138595f4 Binary files /dev/null and b/sample/db/samples/images/solidus_tshirt_back_white.png differ diff --git a/sample/db/samples/images/solidus_tshirt_black.png b/sample/db/samples/images/solidus_tshirt_black.png new file mode 100644 index 00000000000..f49b764c61e Binary files /dev/null and b/sample/db/samples/images/solidus_tshirt_black.png differ diff --git a/sample/db/samples/images/solidus_tshirt_blue.png b/sample/db/samples/images/solidus_tshirt_blue.png new file mode 100644 index 00000000000..ff2d52951bb Binary files /dev/null and b/sample/db/samples/images/solidus_tshirt_blue.png differ diff --git a/sample/db/samples/images/solidus_tshirt_white.png b/sample/db/samples/images/solidus_tshirt_white.png new file mode 100644 index 00000000000..4d7d1a1534a Binary files /dev/null and b/sample/db/samples/images/solidus_tshirt_white.png differ diff --git a/sample/db/samples/images/tote_bag_ruby.jpg b/sample/db/samples/images/tote_bag_ruby.jpg new file mode 100644 index 00000000000..f39ba1e11a1 Binary files /dev/null and b/sample/db/samples/images/tote_bag_ruby.jpg differ diff --git a/sample/db/samples/images/tote_bag_solidus.jpg b/sample/db/samples/images/tote_bag_solidus.jpg new file mode 100644 index 00000000000..165204b46ac Binary files /dev/null and b/sample/db/samples/images/tote_bag_solidus.jpg differ diff --git a/sample/db/samples/option_values.rb b/sample/db/samples/option_values.rb index a5b9f600654..86cc7322bda 100644 --- a/sample/db/samples/option_values.rb +++ b/sample/db/samples/option_values.rb @@ -33,12 +33,24 @@ { name: "Red", presentation: "Red", - position: 1, + position: 5, option_type: color }, { name: "Green", presentation: "Green", + position: 4, + option_type: color + }, + { + name: "Black", + presentation: "Black", + position: 1, + option_type: color + }, + { + name: "White", + presentation: "White", position: 2, option_type: color }, diff --git a/sample/db/samples/orders.rb b/sample/db/samples/orders.rb index 10900194071..30405b621d5 100644 --- a/sample/db/samples/orders.rb +++ b/sample/db/samples/orders.rb @@ -28,13 +28,13 @@ ) orders[0].line_items.create!( - variant: Spree::Product.find_by!(name: "Ruby on Rails Tote").master, + variant: Spree::Product.find_by!(name: "Solidus Tote").master, quantity: 1, price: 15.99 ) orders[1].line_items.create!( - variant: Spree::Product.find_by!(name: "Ruby on Rails Bag").master, + variant: Spree::Product.find_by!(name: "Solidus Snapback 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 4527d0ce05f..66aa29bb153 100644 --- a/sample/db/samples/product_option_types.rb +++ b/sample/db/samples/product_option_types.rb @@ -5,6 +5,6 @@ size = Spree::OptionType.find_by!(presentation: "Size") color = Spree::OptionType.find_by!(presentation: "Color") -ror_baseball_jersey = Spree::Product.find_by!(name: "Ruby on Rails Baseball Jersey") -ror_baseball_jersey.option_types = [size, color] -ror_baseball_jersey.save! +solidus_tshirt = Spree::Product.find_by!(name: "Solidus T-Shirt") +solidus_tshirt.option_types = [size, color] +solidus_tshirt.save! diff --git a/sample/db/samples/product_properties.rb b/sample/db/samples/product_properties.rb index 43cc4215b05..3e37ef1ec4b 100644 --- a/sample/db/samples/product_properties.rb +++ b/sample/db/samples/product_properties.rb @@ -2,61 +2,122 @@ products = { - "Ruby on Rails Baseball Jersey" => + "Solidus Tote" => + { + "Type" => "Tote", + "Size" => %{15" x 18" x 6"}, + "Material" => "Canvas" + }, + "Ruby Tote" => + { + "Type" => "Tote", + "Size" => %{15" x 18" x 6"}, + "Material" => "Canvas" + }, + "Solidus Snapback Cap" => + { + "Type" => "Snapback Cap", + "Size" => "One Size", + "Material" => "100% Cotton" + }, + "Solidus T-Shirt" => + { + "Manufacturer" => "Jerseys", + "Brand" => "Conditioned", + "Model" => "TL9002", + "Shirt Type" => "Ringer T", + "Sleeve Type" => "Short", + "Made from" => "100% Cotton", + "Fit" => "Loose", + "Gender" => "Men's" + }, + "Solidus Long Sleeve" => { "Manufacturer" => "Wilson", "Brand" => "Wannabe Sports", - "Model" => "JK1002", - "Shirt Type" => "Baseball Jersey", + "Model" => "TL9002", + "Shirt Type" => "Jersey", "Sleeve Type" => "Long", "Made from" => "100% cotton", "Fit" => "Loose", "Gender" => "Men's" }, - "Ruby on Rails Jr. Spaghetti" => + "Solidus Hoodie Zip" => { "Manufacturer" => "Jerseys", + "Brand" => "Wannabe Sports", + "Model" => "HD9001", + "Shirt Type" => "Jersey", + "Sleeve Type" => "Long", + "Made from" => "100% cotton", + "Fit" => "Loose", + "Gender" => "Unisex" + }, + "Ruby Hoodie" => + { + "Manufacturer" => "Wilson", "Brand" => "Resiliance", - "Model" => "TL174", - "Shirt Type" => "Jr. Spaghetti T", - "Sleeve Type" => "None", + "Model" => "HD2001", + "Shirt Type" => "Baseball", + "Sleeve Type" => "Long", "Made from" => "90% Cotton, 10% Nylon", - "Fit" => "Form", - "Gender" => "Women's" + "Fit" => "Loose", + "Gender" => "Unisex" }, - "Ruby on Rails Ringer T-Shirt" => + "Ruby Hoodie Zip" => { "Manufacturer" => "Jerseys", - "Brand" => "Conditioned", - "Model" => "TL9002", - "Shirt Type" => "Ringer T", - "Sleeve Type" => "Short", - "Made from" => "100% Vellum", + "Brand" => "Wannabe Sports", + "Model" => "HD9001", + "Shirt Type" => "Jersey", + "Sleeve Type" => "Long", + "Made from" => "100% cotton", "Fit" => "Loose", - "Gender" => "Men's" + "Gender" => "Unisex" }, - "Ruby on Rails Tote" => + "Ruby Polo" => { - "Type" => "Tote", - "Size" => %{15" x 18" x 6"}, - "Material" => "Canvas" + "Manufacturer" => "Wilson", + "Brand" => "Resiliance", + "Model" => "PL9001", + "Shirt Type" => "Ringer T", + "Sleeve Type" => "Short", + "Made from" => "100% Cotton", + "Fit" => "Slim", + "Gender" => "Men's" }, - "Ruby on Rails Bag" => + "Solidus Mug" => { - "Type" => "Messenger", - "Size" => %{14 1/2" x 12" x 5"}, - "Material" => "600 Denier Polyester" + "Type" => "Mug", + "Size" => %{4.5" tall, 3.25" dia.} }, - "Ruby on Rails Mug" => + "Ruby Mug" => { "Type" => "Mug", "Size" => %{4.5" tall, 3.25" dia.} }, - "Ruby on Rails Stein" => + "Solidus Girly" => { - "Type" => "Stein", - "Size" => %{6.75" tall, 3.75" dia. base, 3" dia. rim} + "Manufacturer" => "Jerseys", + "Brand" => "Conditioned", + "Model" => "WM6001", + "Shirt Type" => "Skinny", + "Sleeve Type" => "Short", + "Made from" => "90% Cotton, 10% Nylon", + "Fit" => "Slim", + "Gender" => "Women's" } + # "Solidus Woman 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" + # } } products.each do |name, properties| diff --git a/sample/db/samples/products.rb b/sample/db/samples/products.rb index cb75f6b4e52..856465caecb 100644 --- a/sample/db/samples/products.rb +++ b/sample/db/samples/products.rb @@ -22,29 +22,29 @@ products = [ { - name: "Ruby on Rails Tote", + name: "Solidus T-Shirt", 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, + height: 20, + width: 10, depth: 5 }, { - name: "Ruby on Rails Bag", + name: "Solidus Long Sleeve", tax_category: tax_category, shipping_category: shipping_category, - price: 22.99, - eur_price: 19, + price: 19.99, + eur_price: 16, weight: 0.5, - height: 5, - width: 5, + height: 20, + width: 10, depth: 5 }, { - name: "Ruby on Rails Baseball Jersey", + name: "Solidus Girly", tax_category: tax_category, shipping_category: shipping_category, price: 19.99, @@ -55,74 +55,103 @@ depth: 5 }, { - name: "Ruby on Rails Jr. Spaghetti", + name: "Solidus Snapback Cap", tax_category: tax_category, shipping_category: shipping_category, - price: 19.99, - eur_price: 16, + price: 15.99, + eur_price: 14, 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 on Rails Ringer T-Shirt", - shipping_category: shipping_category, + name: "Ruby Hoodie", tax_category: tax_category, - price: 19.99, - eur_price: 16, - weight: 0.5, + shipping_category: shipping_category, + price: 29.99, + eur_price: 27, + weight: 1, height: 20, width: 10, depth: 5 - }, { - name: "Ruby Baseball Jersey", + name: "Ruby Hoodie Zip", tax_category: tax_category, shipping_category: shipping_category, - price: 19.99, - eur_price: 16, - weight: 0.5, + price: 29.99, + eur_price: 27, + weight: 0.8, height: 20, width: 10, depth: 5 - }, { - name: "Apache Baseball Jersey", + name: "Ruby Polo", tax_category: tax_category, shipping_category: shipping_category, - price: 19.99, - eur_price: 16, + price: 26.99, + eur_price: 23, weight: 0.5, height: 20, width: 10, depth: 5 - }, { - name: "Ruby on Rails Mug", + name: "Solidus Mug", + tax_category: tax_category, shipping_category: shipping_category, - price: 13.99, - eur_price: 12, + price: 9.99, + eur_price: 7, weight: 1, height: 5, width: 5, depth: 5 - }, { - name: "Ruby on Rails Stein", + name: "Ruby Mug", + tax_category: tax_category, shipping_category: shipping_category, - price: 16.99, - eur_price: 14, + price: 9.99, + eur_price: 7, weight: 1, height: 5, width: 5, depth: 5 - + }, + { + name: "Solidus Tote", + tax_category: tax_category, + shipping_category: shipping_category, + price: 15.99, + eur_price: 14, + weight: 0.5, + height: 20, + width: 10, + depth: 5 + }, + { + name: "Ruby Tote", + tax_category: tax_category, + shipping_category: shipping_category, + price: 15.99, + eur_price: 14, + weight: 0.5, + height: 20, + width: 10, + depth: 5 } ] diff --git a/sample/db/samples/taxons.rb b/sample/db/samples/taxons.rb index e58607f263c..72d98a2c002 100644 --- a/sample/db/samples/taxons.rb +++ b/sample/db/samples/taxons.rb @@ -7,15 +7,18 @@ brands = Spree::Taxonomy.find_by!(name: "Brand") products = { - ror_tote: "Ruby on Rails Tote", - ror_bag: "Ruby on Rails Bag", - ror_mug: "Ruby on Rails Mug", - ror_stein: "Ruby on Rails Stein", - ror_baseball_jersey: "Ruby on Rails Baseball Jersey", - ror_jr_spaghetti: "Ruby on Rails Jr. Spaghetti", - ror_ringer: "Ruby on Rails Ringer T-Shirt", - apache_baseball_jersey: "Apache Baseball Jersey", - ruby_baseball_jersey: "Ruby Baseball Jersey" + 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_girly: "Solidus Girly" } products.each do |key, name| @@ -29,29 +32,38 @@ position: 0 }, { - name: "Bags", + name: "Clothing", + taxonomy: categories, + parent: "Categories" + }, + { + name: "Caps", taxonomy: categories, parent: "Categories", position: 1, products: [ - products[:ror_tote], - products[:ror_bag] + products[:solidus_snapback_cap] ] }, { - name: "Mugs", + name: "Bags", taxonomy: categories, parent: "Categories", position: 2, products: [ - products[:ror_mug], - products[:ror_stein] + products[:solidus_tote], + products[:ruby_tote] ] }, { - name: "Clothing", + name: "Mugs", taxonomy: categories, - parent: "Categories" + parent: "Categories", + position: 3, + products: [ + products[:solidus_mug], + products[:ruby_mug] + ] }, { name: "Shirts", @@ -59,7 +71,20 @@ parent: "Clothing", position: 0, products: [ - products[:ror_jr_spaghetti] + products[:solidus_long], + products[:ruby_polo], + products[:solidus_girly] + ] + }, + { + name: "Hoodie", + taxonomy: categories, + parent: "Clothing", + position: 0, + products: [ + products[:solidus_hoodie], + products[:ruby_hoodie], + products[:ruby_hoodie_zip] ] }, { @@ -67,10 +92,7 @@ taxonomy: categories, parent: "Clothing", products: [ - products[:ror_baseball_jersey], - products[:ror_ringer], - products[:apache_baseball_jersey], - products[:ruby_baseball_jersey] + products[:solidus_tshirt] ], position: 0 }, @@ -79,33 +101,29 @@ taxonomy: brands }, { - name: "Ruby", - taxonomy: brands, - parent: "Brand", - products: [ - products[:ruby_baseball_jersey] - ] - }, - { - name: "Apache", + name: "Solidus", taxonomy: brands, parent: "Brand", products: [ - products[:apache_baseball_jersey] + products[:solidus_tshirt], + products[:solidus_long], + products[:solidus_snapback_cap], + products[:solidus_hoodie], + products[:solidus_mug], + products[:solidus_tote], + products[:solidus_girly] ] }, { - name: "Rails", + name: "Ruby", taxonomy: brands, parent: "Brand", products: [ - products[:ror_tote], - products[:ror_bag], - products[:ror_mug], - products[:ror_stein], - products[:ror_baseball_jersey], - products[:ror_jr_spaghetti], - products[:ror_ringer] + 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 92730a5ef0a..bf86537c429 100644 --- a/sample/db/samples/variants.rb +++ b/sample/db/samples/variants.rb @@ -3,15 +3,18 @@ Spree::Sample.load_sample("option_values") Spree::Sample.load_sample("products") -ror_baseball_jersey = Spree::Product.find_by!(name: "Ruby on Rails Baseball Jersey") -ror_tote = Spree::Product.find_by!(name: "Ruby on Rails Tote") -ror_bag = Spree::Product.find_by!(name: "Ruby on Rails Bag") -ror_jr_spaghetti = Spree::Product.find_by!(name: "Ruby on Rails Jr. Spaghetti") -ror_mug = Spree::Product.find_by!(name: "Ruby on Rails Mug") -ror_ringer = Spree::Product.find_by!(name: "Ruby on Rails Ringer T-Shirt") -ror_stein = Spree::Product.find_by!(name: "Ruby on Rails Stein") -ruby_baseball_jersey = Spree::Product.find_by!(name: "Ruby Baseball Jersey") -apache_baseball_jersey = Spree::Product.find_by!(name: "Apache Baseball Jersey") +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_girly = Spree::Product.find_by!(name: "Solidus Girly") small = Spree::OptionValue.find_by!(name: "Small") medium = Spree::OptionValue.find_by!(name: "Medium") @@ -21,105 +24,191 @@ red = Spree::OptionValue.find_by!(name: "Red") blue = Spree::OptionValue.find_by!(name: "Blue") green = Spree::OptionValue.find_by!(name: "Green") +black = Spree::OptionValue.find_by!(name: "Black") +white = Spree::OptionValue.find_by!(name: "White") variants = [ { - product: ror_baseball_jersey, - option_values: [small, red], - sku: "ROR-00001", + product: solidus_tshirt, + option_values: [small, blue], + sku: "SOL-00003", + cost_price: 17 + }, + { + product: solidus_tshirt, + option_values: [small, black], + sku: "SOL-00002", + cost_price: 17 + }, + { + product: solidus_tshirt, + option_values: [small, white], + sku: "SOL-00004", + cost_price: 17 + }, + { + product: solidus_tshirt, + option_values: [medium, blue], + sku: "SOL-00005", + cost_price: 17 + }, + { + product: solidus_tshirt, + option_values: [large, white], + sku: "SOL-00006", + cost_price: 17 + }, + { + product: solidus_tshirt, + option_values: [large, black], + sku: "SOL-00007", + cost_price: 17 + }, + { + product: solidus_tshirt, + option_values: [extra_large, blue], + sku: "SOL-0008", + cost_price: 17 + }, + { + product: solidus_long, + option_values: [small, black], + sku: "SOL-LS02", cost_price: 17 }, { - product: ror_baseball_jersey, + product: solidus_long, + option_values: [small, white], + sku: "SOL-LS01", + cost_price: 17 + }, + { + product: solidus_long, option_values: [small, blue], - sku: "ROR-00002", + sku: "SOL-LS03", cost_price: 17 }, { - product: ror_baseball_jersey, - option_values: [small, green], - sku: "ROR-00003", + product: solidus_long, + option_values: [medium, white], + sku: "SOL-LS04", cost_price: 17 }, { - product: ror_baseball_jersey, - option_values: [medium, red], - sku: "ROR-00004", + product: solidus_long, + option_values: [medium, black], + sku: "SOL-LS05", cost_price: 17 }, { - product: ror_baseball_jersey, + product: solidus_long, option_values: [medium, blue], - sku: "ROR-00005", + sku: "SOL-LS06", cost_price: 17 }, { - product: ror_baseball_jersey, - option_values: [medium, green], - sku: "ROR-00006", + product: solidus_long, + option_values: [large, white], + sku: "SOL-LS07", cost_price: 17 }, { - product: ror_baseball_jersey, - option_values: [large, red], - sku: "ROR-00007", + product: solidus_long, + option_values: [large, black], + sku: "SOL-LS08", cost_price: 17 }, { - product: ror_baseball_jersey, + product: solidus_long, option_values: [large, blue], - sku: "ROR-00008", + sku: "SOL-LS09", + cost_price: 17 + }, + { + product: solidus_girly, + option_values: [small, black], + sku: "SOL-WM001", + cost_price: 17 + }, + { + product: solidus_girly, + option_values: [small, blue], + sku: "SOL-WM002", cost_price: 17 }, { - product: ror_baseball_jersey, - option_values: [large, green], - sku: "ROR-00009", + product: solidus_girly, + option_values: [small, white], + sku: "SOL-WM003", cost_price: 17 }, { - product: ror_baseball_jersey, - option_values: [extra_large, green], - sku: "ROR-00010", + product: solidus_girly, + option_values: [medium, blue], + sku: "SOL-WM004", + cost_price: 17 + }, + { + product: solidus_girly, + option_values: [medium, white], + sku: "SOL-WM005", + cost_price: 17 + }, + { + product: solidus_girly, + option_values: [medium, black], + sku: "SOL-WM006", cost_price: 17 } ] masters = { - ror_baseball_jersey => { - sku: "ROR-001", + solidus_tote => { + sku: "SOL-TOT01", cost_price: 17 }, - ror_tote => { - sku: "ROR-00011", + ruby_tote => { + sku: "RUB-TOT01", cost_price: 17 }, - ror_bag => { - sku: "ROR-00012", - cost_price: 21 - }, - ror_jr_spaghetti => { - sku: "ROR-00013", + solidus_snapback_cap => { + sku: "SOL-SNC01", cost_price: 17 }, - ror_mug => { - sku: "ROR-00014", - cost_price: 11 + solidus_tshirt => { + sku: "SOL-00001", + cost_price: 17 }, - ror_ringer => { - sku: "ROR-00015", + solidus_long => { + sku: "SOL-LS00", cost_price: 17 }, - ror_stein => { - sku: "ROR-00016", - cost_price: 15 + solidus_hoodie => { + sku: "SOL-HD00", + cost_price: 27 }, - apache_baseball_jersey => { - sku: "APC-00001", - cost_price: 17 + ruby_hoodie => { + sku: "RUB-HD01", + cost_price: 27 + }, + ruby_hoodie_zip => { + sku: "RUB-HD00", + cost_price: 27 + }, + ruby_polo => { + sku: "RUB-PL01", + cost_price: 23 + }, + solidus_mug => { + sku: "SOL-MG01", + cost_price: 7 + }, + ruby_mug => { + sku: "RUB-MG01", + cost_price: 7 }, - ruby_baseball_jersey => { - sku: "RUB-00001", + solidus_girly => { + sku: "SOL-WM00", cost_price: 17 } }