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
display prices after filtering correctly
Łukasz Adamczyk5e5be849af97
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 45646cd779..65eeb78499 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@@ -21,6 +21,6 @@ Spree.ready(function() {const urlParams = new URLSearchParams(dataParams)urlParams.set('price', formattedPriceRange)- priceRangeSubmitButton.href = `${location.pathname}?${decodeURIComponent(urlParams.toString())}`+ priceRangeSubmitButton.href = decodeURIComponent(`${location.pathname}?${urlParams.toString()}`)}});diff --git a/frontend/app/helpers/spree/products_filters_helper.rb b/frontend/app/helpers/spree/products_filters_helper.rbindex 2997b9172c..101338f677 100644--- a/frontend/app/helpers/spree/products_filters_helper.rb+++ b/frontend/app/helpers/spree/products_filters_helper.rb@@ -1,15 +1,16 @@module Spreemodule ProductsFiltersHelperdef min_price_filter_input- price_filter_input(name: :min_price, value: prices.min, placeholder: Spree.t(:min))+ price_filter_input(name: :min_price, value: prices.first, placeholder: Spree.t(:min))enddef max_price_filter_input- price_filter_input(name: :max_price, value: prices.max, placeholder: Spree.t(:max))+ price_filter_input(name: :max_price, value: prices.last, placeholder: Spree.t(:max))enddef price_filter_input(name:, value:, placeholder:)- number_field_tag(name, value, min: 0, step: 1, placeholder: placeholder)+ price_value = value&.zero? ? '' : value+ number_field_tag(name, price_value, min: 0, step: 1, placeholder: placeholder)endprivate@@ -17,7 +18,7 @@ module Spreedef pricesprice_param = params[:price].to_ssplit_prices = price_param.split('-')- split_prices.map(&:to_i)+ split_prices.map { |price| price.to_money.to_i }endendenddiff --git a/frontend/spec/features/products_spec.rb b/frontend/spec/features/products_spec.rbindex 03e423fede..55163a4c89 100644--- a/frontend/spec/features/products_spec.rb+++ b/frontend/spec/features/products_spec.rb@@ -309,6 +309,9 @@ describe 'Visiting Products', type: :feature, inaccessible: true do'Ruby on Rails Mug','Ruby on Rails Tote')++ expect(page).to have_field(Spree.t(:min), with: '55')+ expect(page).to have_field(Spree.t(:max), with: '103')endit 'is able to display products when providing only min amount of 55 dollars' do@@ -331,6 +334,9 @@ describe 'Visiting Products', type: :feature, inaccessible: true do'Ruby Baseball Jersey','Apache Baseball Jersey')++ expect(page).to have_field(Spree.t(:min), with: '56')+ expect(page).to have_field(Spree.t(:max), with: '')endit 'is able to display products when providing only max amount of 56 dollars' do@@ -348,6 +354,9 @@ describe 'Visiting Products', type: :feature, inaccessible: true do'Ruby on Rails Mug','Ruby on Rails Tote')++ expect(page).to have_field(Spree.t(:min), with: '')+ expect(page).to have_field(Spree.t(:max), with: '56')endend