I have created various filters based on new properties I have set up. I
only want to display certain filters under a specific taxon. What is the
cleanest spree way to do this? For example I would like the material
filter only to be shown when the taxon is clothing. Below is part of the
code I have copied over into my directory (models/spree/taxon.rb).
# indicate which filters should be used for a taxon
# this method should be customized to your own site
def applicable_filters
fs = []
# fs << ProductFilters.taxons_below(self)
## unless it's a root taxon? left open for demo purposes
fs << ProductFilters.price_filter if
ProductFilters.respond_to?(:price_filter)
fs << ProductFilters.color_filter if
ProductFilters.respond_to?(:color_filter)
fs << ProductFilters.material_filter if
ProductFilters.respond_to?(:material_filter)
fs << ProductFilters.pattern_filter if
ProductFilters.respond_to?(:pattern_filter)
fs << ProductFilters.brand_filter if
ProductFilters.respond_to?(:brand_filter)
end
Thank you in advance for your help!