4

Using contextual filters, I have created a view which shows a page of users at us/california, based on a taxonomy I have made of locations.

This taxonomy is hierarchical, though, so when the user selects San Francisco, they no longer appear on the page.

I would like them to appear on both us/california and us/california/sanfrancisco.

How can I achieve this?

0
0

I remember working on the same type of issue while ago.

The point here is Drupal will store only the deepest taxonomy item you selected and not the whole taxonomy path.

I solved that by hooking the node_save to save the whole path of taxonomy, but I'm not sure that's the best approach.

The other approach would be to find a way with views to make a join with the higher hierarchy level, by using relationships.

Another load could be to look at better_exposed_filter or hierarchical_select

I hope it helps.

Cheers

1
  • No need to save using the node_save, if you are using hierarchical select module, you change the widget setting for particular field and save that full taxonomy with all levels – Sanjay Jul 6 '16 at 8:11
0

Simple hierarchical select

This module does the trick for your need.

Install this module from the below link

https://www.drupal.org/project/shs

After enable this module, got to your view and add filter criteria.

You can see Content: Has taxonomy Terms (Simple hierarchical select). Select that option and select your vocab. to filter.

Refer the screenshot.

enter image description here

By apply this you have filter criteria, check the url by apply those filter criteria.

Now make it display none and try to apply your taxonomy ids into this filter by try to make url like the one you get after apply filters.

No need to apply contexual filter, you can do that easily with filter criteria.

I hope this help you in your 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.