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.

Revert "V-3066 FIX filtering storefront products with AND instead of OR" (#12633)

Damian Legawiecb0f436526243
diff --git a/storefront/app/controllers/spree/store_controller.rb b/storefront/app/controllers/spree/store_controller.rb
index ab9e3396d6..a3e2d32d68 100644
--- a/storefront/app/controllers/spree/store_controller.rb
+++ b/storefront/app/controllers/spree/store_controller.rb
@@ -126,7 +126,6 @@ module Spree
filter[:taxon_ids] ||= [taxon&.id.to_s].compact
filter[:taxons] = filter[:taxon_ids].join(',')
- filter[:concat_taxons] = filter[:taxons] if filter[:taxon_ids].size > 1
if filter.key?(:min_price) || filter.key?(:max_price)
min_price = filter[:min_price].presence || 0
diff --git a/storefront/spec/controllers/spree/products_controller_spec.rb b/storefront/spec/controllers/spree/products_controller_spec.rb
index c572196c13..f95553e005 100644
--- a/storefront/spec/controllers/spree/products_controller_spec.rb
+++ b/storefront/spec/controllers/spree/products_controller_spec.rb
@@ -16,53 +16,6 @@ describe Spree::ProductsController, type: :controller do
expect(response).to render_template(:index)
expect(assigns(:current_page)).to be_a(Spree::Pages::ShopAll)
end
-
- context 'when filtering' do
- let(:taxon) { create(:taxon) }
-
- context 'by one taxon' do
- let(:product) { create(:product, stores: [store], taxons: [taxon]) }
-
- before do
- product
- get :index, params: { filter: { taxon_ids: [taxon.id] } }
- end
-
- it 'returns one product' do
- expect(assigns(:storefront_products).records).to eq([product])
- end
- end
-
- context 'by multiple taxons' do
- let(:taxon2) { create(:taxon) }
-
- context 'and product is associated with both taxons' do
- let(:product) { create(:product, stores: [store], taxons: [taxon, taxon2]) }
-
- before do
- product
- get :index, params: { filter: { taxon_ids: [taxon.id, taxon2.id] } }
- end
-
- it 'returns the product' do
- expect(assigns(:storefront_products).records).to eq([product])
- end
- end
-
- context 'and product is associated with only one of the taxons' do
- let(:product) { create(:product, stores: [store], taxons: [taxon]) }
-
- before do
- product
- get :index, params: { filter: { taxon_ids: [taxon.id, taxon2.id] } }
- end
-
- it 'does not return the product' do
- expect(assigns(:storefront_products).records).to be_empty
- end
- end
- end
- end
end
describe '#show' do