1

I created pages for brands that I sell on my shop. Each product is associated with a brand taxonomy term. I created a view block that displays pages of brands. The block is displayed throughout the store and displays the entire list of brands. How to display only those brands related to product pages?

I know we need to use contextual filters, but I do not know how to configure.

2 Answers 2

0

There are certain steps which you can follow.

  1. I have created a vocabulary Brand, which contains all brand.
  2. I added a field in Article Content Type, field_brand, which is term reference type.
  3. After that, I create a view of type Taxonomy Term, which show terms of Brand Vocab.
  4. Add Relationship for field_brand (Taxonomy term: Content using Brand).
  5. Add Contextual Filter, field_brand ( Content: Brand (field_brand)), which uses above relationship.
  6. Under WHEN THE FILTER VALUE IS NOT AVAILABLE, Click on Radio Button Provide Default Value, Choose from drop down, Taxonomy Term ID from URL, uncheck checkbox Load default filter from term page, and check checkbox, Load default filter from node page, that's, check Limit terms by vocabulary, select your vocabulary, in my case it was Brand, under Multiple View Handling, check radio box, Filter to items that share all terms.

I have attached screenshot for the last step settings.

enter image description here

0

You can do this with the following:

  • Create a new View to display the Taxonomy Terms for Brand enter image description here
  • In the Views UI, add a new Relationship Taxonomy term: Content with term, and uncheck "require this relationship".

  • Add a new Contextual filter : Content: Nid and choose the just-created relationship as the relationship. Provide default value > Content ID From URL under When the filter value is NOT available.

    enter image description here

    enter image description here

2
  • hello, thank you, but it does not work, here the export of sight pastebin.com/i7Wf8yEx
    – user54067
    Commented Mar 26, 2016 at 3:23
  • hi, hmm from what i can see you have created a view that lists nodes. What you will have to create is a view that will list taxonomy terms. See updated answer
    – St0iK
    Commented Mar 26, 2016 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.