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.

Fixed price filtering - always use SQL between

Damian Legawiec83a1dacd2512
diff --git a/core/lib/spree/core/product_filters.rb b/core/lib/spree/core/product_filters.rb
index 8f534a29a8..de24f226d8 100644
--- a/core/lib/spree/core/product_filters.rb
+++ b/core/lib/spree/core/product_filters.rb
@@ -68,9 +68,9 @@ module Spree
def self.price_filter
v = Spree::Price.arel_table
conds = [[Spree.t(:under_price, price: format_price(10)), v[:amount].lteq(10)],
- ["#{format_price(10)} - #{format_price(15)}", v[:amount].in(10..15)],
- ["#{format_price(15)} - #{format_price(18)}", v[:amount].in(15..18)],
- ["#{format_price(18)} - #{format_price(20)}", v[:amount].in(18..20)],
+ ["#{format_price(10)} - #{format_price(15)}", v[:amount].between(10..15)],
+ ["#{format_price(15)} - #{format_price(18)}", v[:amount].between(15..18)],
+ ["#{format_price(18)} - #{format_price(20)}", v[:amount].between(18..20)],
[Spree.t(:or_over_price, price: format_price(20)), v[:amount].gteq(20)]]
{
name: Spree.t(:price_range),