0

Using two taxonomies.

Fruit:

Banana Orange Blueberry Strawberry Lemon

Fruit taxonomy has a term reference to the color taxonomy

Color:

Red Orange Yellow Blue Purple Green

Created a view using the built in taxonomy term view in a content pane::

Fields Taxonomy term: Fruit Color [this is excluded from display]

Taxonomy term: Name

Filter criteria Taxonomy vocabulary: Machine name (= Fruit)

Relationships Taxonomy term: Content using Fruit

[Configure Relationship: Taxonomy term: Content using Fruit Relate each Content with a Fruit set to the term. Require this relationship]

View Output::

Red Strawberry

Orange Orange

Yellow Banana Lemon

Blue Blueberry

I would like to add a contextual filter to this view that takes the Color taxonomy name from the url and only shows the fruit for that color.

color/red would only show:

Red Strawberry

color/yellow would only show:

Yellow Banana Lemon

I'm stuck on how to add the contextual filter. I've tried taxonomy term name with validation set to change the term name to id. I also tried the fruit_color field with validation set to change the term name to id.

Should the term name/fruit_color field be configured differently? Do I need to add another relationship?

Additional info: The view displays taxonomy terms. The result set is empty when I try adding a contextual filter. The relationship field should only show Fruit terms that have been used at least once to tag content.

6
  • Is the view you are using set to display content? Or taxonomy terms? Mar 29, 2016 at 4:21
  • It is displaying taxonomy terms.
    – Venn
    Mar 29, 2016 at 4:54
  • Sounds good, is the current problem an empty result set or what? Please update your question with this, it's important. Mar 29, 2016 at 4:57
  • Another question: Do you need the relationship field to only show Fruit terms that have been used at least once to tag content? Or am I assuming too much? Mar 29, 2016 at 4:59
  • I am following your setup/configuration, but cannot reproduce the problem. Does your View display results without the Contextual Filter? Do you have content tagged with Fruit at the moment? (ignore this last question if it is too obvious) Mar 29, 2016 at 5:50

1 Answer 1

0

To answer you question: No, it shouldn't need to be configured differently; it should work the way you describe. Here is a screenshot of my configuration (following your description) that works as you would expect (you can see the contextual filter in the background set to 'yellow'):

enter image description here

Perhaps you can spot some tiny deviation from your config here.
Good luck in any case!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.