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.

Update config naming to pluralized as per rails routing conversion.

Matthew Kennedy11e6a63d0303
diff --git a/core/app/models/spree/app_configuration.rb b/core/app/models/spree/app_configuration.rb
index 1029b3cf7f..7458061611 100644
--- a/core/app/models/spree/app_configuration.rb
+++ b/core/app/models/spree/app_configuration.rb
@@ -76,9 +76,9 @@ module Spree
@searcher_class ||= Spree::Core::Search::Base
end
- # These paths are used if Spree::Frontend is not being used.
- preference :storefront_product_path, :string, default: 'products'
- preference :storefront_taxon_path, :string, default: 't'
+ # Sets the path used for products and taxons.
+ preference :storefront_products_path, :string, default: 'products'
+ preference :storefront_taxons_path, :string, default: 't'
attr_writer :searcher_class
end
diff --git a/core/app/models/spree/menu_item.rb b/core/app/models/spree/menu_item.rb
index 8d4a2746ea..03a3d9f2aa 100644
--- a/core/app/models/spree/menu_item.rb
+++ b/core/app/models/spree/menu_item.rb
@@ -48,7 +48,7 @@ module Spree
if frontend_available?
Spree::Core::Engine.routes.url_helpers.nested_taxons_path(linked_resource.permalink)
else
- "/#{Spree::Config[:storefront_taxon_path]}/#{linked_resource.permalink}"
+ "/#{Spree::Config[:storefront_taxons_path]}/#{linked_resource.permalink}"
end
when 'Spree::Product'
return if linked_resource.nil?
@@ -56,7 +56,7 @@ module Spree
if frontend_available?
Spree::Core::Engine.routes.url_helpers.product_path(linked_resource)
else
- "/#{Spree::Config[:storefront_product_path]}/#{linked_resource.slug}"
+ "/#{Spree::Config[:storefront_products_path]}/#{linked_resource.slug}"
end
when 'Home Page'
'/'
diff --git a/frontend/config/routes.rb b/frontend/config/routes.rb
index abdd79dfd6..246828ff63 100644
--- a/frontend/config/routes.rb
+++ b/frontend/config/routes.rb
@@ -2,11 +2,11 @@ Spree::Core::Engine.add_routes do
scope '(:locale)', locale: /#{Spree.available_locales.join('|')}/, defaults: { locale: nil } do
root to: 'home#index'
- resources :products, only: [:index, :show], path: "/#{Spree::Config[:storefront_product_path]}"
+ resources :products, only: [:index, :show], path: "/#{Spree::Config[:storefront_products_path]}"
- get "/#{Spree::Config[:storefront_product_path]}/:id/related", to: 'products#related'
+ get "/#{Spree::Config[:storefront_products_path]}/:id/related", to: 'products#related'
# route globbing for pretty nested taxon and product paths
- get "/#{Spree::Config[:storefront_taxon_path]}/*id", to: 'taxons#show', as: :nested_taxons
+ get "/#{Spree::Config[:storefront_taxons_path]}/*id", to: 'taxons#show', as: :nested_taxons
get '/product_carousel/:id', to: 'taxons#product_carousel'
# non-restful checkout stuff