This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Spree | |
| module Core | |
| module ProductFilters | |
| # Test for discrete option values selection | |
| def ProductFilters.option_with_values(option_scope, option, values) | |
| # get values IDs for Option with name {@option} and value-names in {@values} for use in SQL below | |
| option_values = Spree::OptionValue.where(:presentation => [values].flatten).joins(:option_type).where(OptionType.table_name => {:name => option}).pluck("#{OptionValue.table_name}.id") | |
| return option_scope if option_values.empty? | |