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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Added `StoreController#storefront_product_finder` method (#13025)
Damian Legawiec773811fcfb99
diff --git a/storefront/app/controllers/spree/store_controller.rb b/storefront/app/controllers/spree/store_controller.rbindex ba2f591364..e9ddd2de97 100644--- a/storefront/app/controllers/spree/store_controller.rb+++ b/storefront/app/controllers/spree/store_controller.rb@@ -29,7 +29,7 @@ module Spreehelper_method :permitted_products_params, :products_filters_params,:storefront_products_scope, :storefront_products,:default_products_sort, :default_products_finder_params,- :storefront_products_includes+ :storefront_products_includes, :storefront_products_finderhelper_method :stored_location@@ -123,6 +123,10 @@ module Spree@accurate_title ||= current_store.seo_title.presence || current_store.nameend+ def storefront_products_finder+ @storefront_products_finder ||= Spree::Dependencies.products_finder.constantize+ end+def storefront_products_scope@storefront_products_scope ||= current_store.products.active(current_currency)end@@ -156,7 +160,7 @@ module Spreefinder_params = default_products_finder_paramsfinder_params[:sort_by] ||= @taxon&.sort_order || 'manual'- products_finder = Spree::Dependencies.products_finder.constantize+ products_finder = storefront_products_finderproducts = products_finder.new(scope: storefront_products_scope, params: finder_params).execute.diff --git a/storefront/app/helpers/spree/filters_helper.rb b/storefront/app/helpers/spree/filters_helper.rbindex 2021c72325..41f5581bde 100644--- a/storefront/app/helpers/spree/filters_helper.rb+++ b/storefront/app/helpers/spree/filters_helper.rb@@ -8,12 +8,10 @@ module Spreeenddef products_for_filters_scope(except_filters: [])- products_finder = Spree::Dependencies.products_finder.constantize-finder_params = default_products_finder_paramsfinder_params[:filter] = finder_params[:filter].except(*except_filters) if except_filters.any?- products = products_finder.new(scope: storefront_products_scope, params: finder_params).execute+ products = storefront_products_finder.new(scope: storefront_products_scope, params: finder_params).executecurrent_store.products.where(id: products.unscope(:order).ids)enddiff --git a/storefront/app/helpers/spree/taxons_helper.rb b/storefront/app/helpers/spree/taxons_helper.rbindex 1f5f7752ad..2d9139d348 100644--- a/storefront/app/helpers/spree/taxons_helper.rb+++ b/storefront/app/helpers/spree/taxons_helper.rb@@ -12,8 +12,7 @@ module Spreesort_by: 'default'}- products_finder = Spree::Dependencies.products_finder.constantize- products_finder.new(scope: current_store.products.includes(storefront_products_includes), params: finder_params).execute+ storefront_products_finder.new(scope: current_store.products.includes(storefront_products_includes), params: finder_params).executeendendend