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
Make `OptionValue#for_products` to work nicely with other scopes on P… (#12836)
Damian Legawiecc0529e14e839
diff --git a/core/app/models/spree/option_value.rb b/core/app/models/spree/option_value.rbindex 52d010b3de..fb9607579e 100644--- a/core/app/models/spree/option_value.rb+++ b/core/app/models/spree/option_value.rb@@ -48,9 +48,8 @@ module Spree}scope :for_products, lambda { |products|- product_ids = products.loaded? ? products.map(&:id) : products-- joins(:variants).where(Spree::Variant.table_name => { product_id: product_ids })+ # we need to use map(&:id) to avoid SQL errors when merging with other scopes+ joins(:variants).where(Spree::Variant.table_name => { product_id: products.map(&:id) })}#diff --git a/storefront/app/helpers/spree/filters_helper.rb b/storefront/app/helpers/spree/filters_helper.rbindex 1a319a8e07..2021c72325 100644--- a/storefront/app/helpers/spree/filters_helper.rb+++ b/storefront/app/helpers/spree/filters_helper.rb@@ -95,7 +95,7 @@ module Spreedef filter_values_for_filter(filter)selected = single_option_filter_selected?(filter.name)if filter.option_values.loaded?- storefront_filter_values_ids = storefront_filter_values_scope(selected).pluck(:id)+ storefront_filter_values_ids = storefront_filter_values_scope(selected).idsfilter.option_values.find_all { |option_value| storefront_filter_values_ids.include?(option_value.id) }else