0

I have vocabulary with these terms:

  • Sport
    • Soccer
    • Hockey
    • ...
  • term
    • subterm
    • ...

And I have content where is chosen one of those subterms.

Then there is a second vocabulary (countries):

  • France
  • GB
  • ...

I need to create view that will show content by path.

For example: /sport/soccer - this will show content with soccer term. (This is done by default)

But I need also this: /sport/soccer/france - content with terms soccer and france.

I know that I have to user Views with contextual filters. I am using Drupal 7 with Views 3.

Thanks for your help.

1

Create three contextual filters: 1) global null (it's at the bottom), this will ignore the first argument 2) normal contextual filter for the first vocabulary, 3) normal contextual filter for the second vocabulary.

By normal I mean that you first select Term ID then Specify validation criteria, Taxonomy term, pick your vocab, Term name converted to term ID. It's a good idea to give these filters an Administrative title found under the More section, so that you can keep track which is which, as they need to be in the right order.

To reduce duplicates, in the view details "Advanced" > "OTHER" > "Query settings", check the box "Distinct" (thanks user2171413).

  • Hah thanks, it works! But there is one problem - duplicates. On /sport/soccer there are two same nodes and on /sport/soccer/france there are 4x same nodes. I checked the reduce duplicates option, but it is not helping. – user2171413 Feb 5 '14 at 21:08
  • Ok, I have just fixed it: in the view details "Advanced" > "OTHER" > "Query settings", check the box "Distinct". Thanks for your help! – user2171413 Feb 5 '14 at 21:13
  • There is one problem when the term name has comma. The path is: something/one-two. The name is One, Two... It won't get the name because there is the comma – user2171413 Feb 9 '14 at 17:49
  • Did you solve this? Maybe edit Pathauto punctuation settings? – Kari Kääriäinen Feb 13 '14 at 22:23

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.