0

My web site has two vocabularies for event content type.
Vocabularies: City and Dance School.

School terms use city terms. I want to show school terms as a list on city term page ( Eg. Newyork Dance Schools).

My city url is ../city/newyork/145

145 is term id. I changed city/newyork url to /city/newyork/145.But it didn't work.

I tried many combinations with views & Conceptual filter&relationships but no result.

I tried this but empty results.(https://drupal.stackexchange.com/a/74605/88821).

I'm stuck on how to handle it. Any advice please..Thanks

0

You have to create a list of all School terms, and then use a Contextual filter to feed Views with information about the City term you're currently viewing (City page), so the School terms results can be reduced to show only the School terms that are related to that particular City.

Build Views that list Terms that reference another Term

  1. Create a View of type Taxonomy term, you only need the Block Display, and choose only the School terms vocabulary
  2. Add a Contextual filter from Taxonomy term Category named after the reference field you're using on the School term Vocabulary to reference Cities
  3. Configure it with these options:
    When the filter value is NOT available
    Provide default value
    Taxonomy term ID from URL
    Load default filter from term page
    When the filter value IS available or a default is provided
    Specify validation criteria
    Taxonomy term
    City
    Filter value type: Term ID
  4. Save the View (adjust other options if you wish) and place the Block in a region of your theme, limit Visibility to show only on City term pages.

You should now see the list of School terms on city pages that relate to that City.

Test Contextual filter from Views UI

To test the Contextual filter while building Views you can use the Preview with contextual filters: field.

Enter all and press the Update preview button to see all results irrespective of the Contextual filter.

Enter the number of a City term TID to see the School terms related to it. For example if the term newyork has the TID 16 enter 16 into the Preview field, and you'll see the School term list is reduced to only those which reference newyork.

  • Many thanks . It worked but only one problem . Newyork(parent)(id:30) and city sub-terms (Yonkers-31 , Albany-32 , New Rochelle-33, Utica-34 etc).. All of them are hierarchical city terms.. Newyork(parent)(id:30) doesn't show sub-term's schools. 31-32-33 id term's schools should be shown on city/newyork/30 url… Any help with this would be awesome I tried parent id filter but id ddn't work. Thanks – Ceyda Güven Aug 16 '18 at 18:03
  • That seems to be a different question with a different solution. Maybe create a new question? Does the Parent (newyork) also have School terms referencing it or do only city sub-terms have them? – prkos Aug 16 '18 at 19:08
  • Yes, parent and sub terms have school term referencing. – Ceyda Güven Aug 16 '18 at 19:24
  • I can't think of a simpler solution right now without an additional module. Are you on D7? This module might be necessary Views arg parent term. – prkos Aug 16 '18 at 19:58
  • Yes I'm on D7.I tried it but it didn't work. Your previous guide is awesome without relationship.Also current solution is gone If I add a relationship. All schools dissepeared and result is empty page. This modüle requires relationship. I'm new at community .I've opened new question as your advice.Your future advice will be appreciated .Thanks Here it is if you wanna check it. drupal.stackexchange.com/questions/267677/… – Ceyda Güven Aug 16 '18 at 20:45

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.