Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

[SD-1106] Fixes categories in samples and links

Robert Nowakowski143687eca575
diff --git a/core/config/locales/en.yml b/core/config/locales/en.yml
index 0c2d4e7424..b8128bbbc4 100644
--- a/core/config/locales/en.yml
+++ b/core/config/locales/en.yml
@@ -663,7 +663,6 @@ en:
jackets_and_coats: JACKET & COASTS
new_collection: NEW COLLECTION
special_offers: SPECIAL OFFERS
- summer_2019: SUMMER 2019
channel: Channel
charged: Charged
checkout: Checkout
@@ -938,7 +937,7 @@ en:
shop_now: SHOP NOW
sportswear: SPORTSWEAR
streetstyle: STREETSTYLE
- summer_2020: Summer 2020
+ summer_year: "Summer %{year}"
summer_collection: Summer Collection
summer_sale: SUMMER SALE
trending: TRENDING
diff --git a/core/lib/generators/spree/install/templates/config/spree_storefront.yml b/core/lib/generators/spree/install/templates/config/spree_storefront.yml
index dfa4e0b202..5b769beebc 100644
--- a/core/lib/generators/spree/install/templates/config/spree_storefront.yml
+++ b/core/lib/generators/spree/install/templates/config/spree_storefront.yml
@@ -18,12 +18,12 @@ default:
:url: /t/women/jackets-and-coats
promo_banners:
- subtitle: New collection
- title: Summer 2019
- url: /t/new-collection/summer-2019
+ title: Summer 2021
+ url: /t/new-collection/summer-2021
image: 'meganav/promo_banner_left-first-category.jpg'
- subtitle: Special Offers
title: Get up to 30% off
- url: /t/special-offers/30-off
+ url: /t/special-offers/30-percent-off
image: 'meganav/promo_banner_right-first-category.jpg'
- title: Men
subtitle: Categories
@@ -39,12 +39,12 @@ default:
:url: /t/men/jackets-and-coats
promo_banners:
- subtitle: New collection
- title: Summer 2019
- url: /t/new-collection/summer-2019
+ title: Summer 2021
+ url: /t/new-collection/summer-2021
image: 'meganav/promo_banner_left-second-category.jpg'
- subtitle: Special Offers
title: Get up to 30% off
- url: /t/special-offers/30-off
+ url: /t/special-offers/30-percent-off
image: 'meganav/promo_banner_right-second-category.jpg'
- title: Sportswear
subtitle: Categories
@@ -58,10 +58,10 @@ default:
:url: /t/sportswear/pants
promo_banners:
- subtitle: New collection
- title: Summer 2019
- url: /t/new-collection/summer-2019
+ title: Summer 2021
+ url: /t/new-collection/summer-2021
image: 'meganav/promo_banner_left-third-category.jpg'
- subtitle: Special Offers
title: Get up to 30% off
- url: /t/special-offers/30-off
+ url: /t/special-offers/30-percent-off
image: 'meganav/promo_banner_right-third-category.jpg'
diff --git a/frontend/app/views/spree/home/index.html.erb b/frontend/app/views/spree/home/index.html.erb
index 5c08f16183..75ed4bf74c 100644
--- a/frontend/app/views/spree/home/index.html.erb
+++ b/frontend/app/views/spree/home/index.html.erb
@@ -65,7 +65,7 @@
<div class="homepage-fashion-trends-box mb-3">
<div class="text-center">
- <div class="homepage-fashion-trends-box-summer-text mb-1"><%= Spree.t('homepage.summer_2020') %></div>
+ <div class="homepage-fashion-trends-box-summer-text mb-1"><%= Spree.t('homepage.summer_year', year: Date.current.year) %></div>
<div class="homepage-fashion-trends-box-fashion-trends-text mb-2"><%= Spree.t('homepage.fashion_trends') %></div>
<div class="homepage-fashion-trends-box-description-text text-center mb-3">
<%= Spree.t('homepage.fashion_trends_note') %>
diff --git a/sample/db/samples/taxons.rb b/sample/db/samples/taxons.rb
index ed2b1e5c4b..e445c4fc95 100644
--- a/sample/db/samples/taxons.rb
+++ b/sample/db/samples/taxons.rb
@@ -2,6 +2,10 @@ require 'csv'
Spree::Sample.load_sample('taxonomies')
+ADDITIONAL_TAXONS = ['Bestsellers', 'Trending', 'Streetstyle', 'Summer Sale'].freeze
+
+SPECIAL_TAXONS = { 'New Collection': 'Summer 2021', 'Special Offers': '30% Off' }.freeze
+
CHILDREN_TAXON_NAMES = CSV.read(File.join(__dir__, 'variants.csv')).map do |(parent_name, taxon_name, _product_name, _color_name)|
[parent_name, taxon_name]
end.uniq
@@ -31,9 +35,21 @@ taxon.permalink = taxon.permalink.gsub('categories/', '')
taxon.taxonomy = categories
taxon.save!
-['Bestsellers', 'Trending', 'Streetstyle', 'Summer Sale'].each do |taxon_name|
+ADDITIONAL_TAXONS.each do |taxon_name|
taxon = categories_taxon.children.where(name: taxon_name).first_or_create!
taxon.permalink = taxon.permalink.gsub('categories/', '')
taxon.taxonomy = categories
taxon.save!
end
+
+SPECIAL_TAXONS.each do |parent_name, taxon_name|
+ parent = categories_taxon.children.where(name: parent_name).first_or_create!
+ parent.permalink = parent.permalink.gsub('categories/', '')
+ parent.taxonomy = categories
+ parent.save!
+
+ taxon = parent.children.where(name: taxon_name).first_or_create!
+ taxon.permalink = taxon.permalink.gsub('categories/', '')
+ taxon.taxonomy = categories
+ taxon.save!
+end