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.

Fix taxon product search.

Matthew Kennedy9833c2dacba5
diff --git a/api/app/serializers/spree/v2/storefront/store_serializer.rb b/api/app/serializers/spree/v2/storefront/store_serializer.rb
index ee1510aa3e..866f261966 100644
--- a/api/app/serializers/spree/v2/storefront/store_serializer.rb
+++ b/api/app/serializers/spree/v2/storefront/store_serializer.rb
@@ -8,7 +8,9 @@ module Spree
:twitter, :instagram, :default_locale, :customer_support_email, :default_country_id, :description,
:address, :contact_phone, :supported_locales
- has_many :menus, :cms_pages
+ has_many :menus
+ has_many :cms_pages
+
has_one :default_country, serializer: :country, record_type: :country, id_method_name: :default_country_id
attribute :favicon_path do |store|
diff --git a/frontend/app/controllers/spree/taxons_controller.rb b/frontend/app/controllers/spree/taxons_controller.rb
index 0797151684..ac4478cb39 100644
--- a/frontend/app/controllers/spree/taxons_controller.rb
+++ b/frontend/app/controllers/spree/taxons_controller.rb
@@ -36,7 +36,15 @@ module Spree
end
def load_products
- @products = Spree::Product.joins(:taxons).where(Taxon.table_name => { id: @taxon.id })
+ search_params = params.merge(
+ current_store: current_store,
+ taxon: @taxon,
+ include_images: true,
+ distinct: true
+ )
+
+ @searcher = build_searcher(search_params)
+ @products = @searcher.retrieve_products
end
def etag