Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
How do you selectively target a filter at a specific taxon?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Greg Murray  
View profile  
 More options Jul 18 2012, 8:53 pm
From: Greg Murray <gr...@me.com>
Date: Wed, 18 Jul 2012 17:53:46 -0700 (PDT)
Local: Wed, Jul 18 2012 8:53 pm
Subject: How do you selectively target a filter at a specific taxon?

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!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ryan Bigg  
View profile  
 More options Jul 20 2012, 2:29 am
From: Ryan Bigg <r...@spreecommerce.com>
Date: Fri, 20 Jul 2012 16:29:28 +1000
Local: Fri, Jul 20 2012 2:29 am
Subject: Re: [spree-user] How do you selectively target a filter at a specific taxon?

Couldn't you just throw an if statement in there to check the Taxon's name? Given that the method is available on the instance of Taxon objects, I would imagine it would be that simple.

Unless I'm missing something?

Also: you should be using a decorator to alter this method rather than copying it over into models/spree/taxon.rb. Those are covered in the Logic Customization guide here: http://guides.spreecommerce.com/logic_customization.html


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »