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
fix issue with mixing Properties and Price filters
Łukasz Adamczyk16584b987c9e
diff --git a/frontend/app/assets/javascripts/spree/frontend/views/spree/products/price_filters.es6 b/frontend/app/assets/javascripts/spree/frontend/views/spree/products/price_filters.es6index 997a4e9f76..8485aff2cd 100644--- a/frontend/app/assets/javascripts/spree/frontend/views/spree/products/price_filters.es6+++ b/frontend/app/assets/javascripts/spree/frontend/views/spree/products/price_filters.es6@@ -22,12 +22,10 @@ Spree.ready(function() {updatePricesForFiltering(minPrice, maxPrice) {const formattedPriceRange = `${minPrice}-${maxPrice}`+ const url = new URL(this.filterButton.href)- const dataParams = JSON.parse(this.filterButton.dataset.params)- const urlParams = new URLSearchParams(dataParams)-- urlParams.set('price', formattedPriceRange)- this.filterButton.href = decodeURIComponent(`${location.pathname}?${urlParams.toString()}`)+ url.searchParams.set('price', formattedPriceRange)+ this.filterButton.href = `${url.pathname}${url.search}`}}diff --git a/frontend/spec/features/products_filtering_spec.rb b/frontend/spec/features/products_filtering_spec.rbindex 6ed858718d..1937a02b60 100644--- a/frontend/spec/features/products_filtering_spec.rb+++ b/frontend/spec/features/products_filtering_spec.rb@@ -39,14 +39,16 @@ describe 'Products filtering', :js dofill_in 'keywords', with: "#{text}\n"end- def click_on_filter(filter_name, value:)+ def click_on_filter(filter_name, value: nil)filter_element = find('.plp-filters-card', text: filter_name)filter_header_element = filter_element.find('.plp-filters-card-header')filter_header_element.click if filter_header_element[:class].include?('collapsed')- filter_element.click_link(value)- wait_for_turbolinks+ if value.present?+ filter_element.click_link(value)+ wait_for_turbolinks+ endenddef wait_for_turbolinks@@ -109,6 +111,12 @@ describe 'Products filtering', :js doexpect(page).to have_selected_filter_with(value: 'ZETA')expect(page).to have_selected_filter_with(value: 'ALPHA')+ click_on_filter 'Price'+ fill_in "$ #{Spree.t(:min)}", with: '19'+ fill_in "$ #{Spree.t(:max)}", with: '20'+ click_on 'DONE'+ expect(page).to have_content 'Second shirt'+expect_working_filters_clearingclick_on_filter 'Price', value: '$50 - $100'