drupal-7drupal-viewsdrupal-taxonomydrupal-exposed-filter

Select parent taxonomy term in Views exposed filters and get results for all its children aswell


I've got a taxonomy vocabulary with simple terms (no parent, no child) and sometimes several terms grouped by a "fake" parent. Why fake? Because nothing is truly associated to this very parent itself.

Example:

enter image description here

I have a View in which I allow users to search for content associated to a term. I exposed the taxonomy filter with an autocomplete widget because there are plenty of terms. The thing is, if the user wants to get all the contents associated to all the children of a parent term, he has to write down every single child separated with a comma like: CCI BW, CCI CONNECT, CCI DE WALLONIE..... etc.

I'd like to allow him to search only for CCI and get all the results for the children. Because for now, it sends back no result.

enter image description here

I hope it is clear enough. If not, I'd try to do better. Thanks in advance.


Solution

  • Have you tried this?

    Steps:

    Display content if it has the selected taxonomy terms, or children of the selected terms. Due to additional complexity, this has fewer options than the versions without depth.

    The depth will match nodes tagged with terms in the hierarchy. For example, if you have the term "fruit" and a child term "apple", with a depth of 1 (or higher) then filtering for the term "fruit" will get nodes that are tagged with "apple" as well as "fruit". If negative, the reverse is true; searching for "apple" will also pick up nodes tagged with "fruit" if depth is -1 (or lower).