0

Using Drupal 7 Views > Contextual Filter, how can I filter on taxonomy term but only match one field on the node, where two fields (primary and secondary) both use the same vocabulary? I have a vocabulary "Category" and I have organization nodes that can reference a category in either a Primary or Secondary field. The concept is that organizations can primarily serve one topic of interest but can secondarily serve others.

I thought I had great, early success, but on closer inspection, the term is matching against both fields (like taxonomy ought). I have had no luck in setting up only the primary field as the contextual filter for a term name, nor have I been able to first filter on taxonomy and then filter on the primary field.

What am I missing here?

Edit: Hmmm.. I wonder if it's because content fields in Views maybe match on "value" and category fields present themselves as "tid"?

Note: I don't think this is the same as Drupal 7 views contextual filters taxonomy name 2 fields using same vocabulary but I do love the way that one was titled!

  • Ok here's a recipe that gets me much closer to where I want to be: Instead of using contextual filters (which gives me the nice url structure of /organizations/%category) and failing, I have found good traction without contextual filter and instead using Better Exposed Filters with a filter type of Links. So long as I require it and select a default, I might be ok. We'll see what happens when I get back to the parent /organizations (no filter/argument) page. – texas-bronius Oct 1 '14 at 16:49
0

Ok - This is also out of the box Taxonomy Term behavior. My issue was I was selecting the wrong option for what I wanted. I wanted the behavior that converts term string to tid, and so the full solution is:

  • Contextual filter on Content: Primary Category field
  • Specify Validation > Taxonomy Term, my vocabulary
  • Select the option Term name converted to Term ID

Bam! Success! Now I get my list of nodes matching that vocabulary's terms as strings but only for the one of the multiple taxonomy fields of that vocabulary on the node. To further exemplify, my next step will be to create another View that is all the Secondary matching terms as "related" but not primary like this one is.

  • For the Taxonomy term field as contextual filter, can we select multiple vocabularies? – Kiran Tej Mar 7 '17 at 5:46
  • Could someone who understands this, explain a little more? I don't understand the solution and I have the same problem with creating a view on a node with multiple fields of the same vocabulary. – Travis Apr 18 '17 at 15:12

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.