Hello,

I believe this must be a duplicate request but have not been able to find a solution yet.

The condition is:

Have a taxonomy list that is made up of 5 parents, each have 7 children. When the nodes are created the users select the more detailed information (i.e. the child's value). Please see the attached image from the node edit screen.

Node Edit (Master List)

Within views, have created an exposed filter that only shows the parents. Please see the attached image from the exposed filter block.

Exposed Block View

Desired result is when a user selects any of the (5) parent options within the exposed filter it inherits all the selected nodes that are assigned the child's values.

Thank you for any and all help.

Regards,
Hg

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

HyperGlide’s picture

Status: Active » Closed (works as designed)

Solved.

Steps:

  1. Open you view in the edit window.
  2. Goto FILTER CRITERIA and click add.
  3. Search for 'taxonomy'<.li>
  4. Select Content: Has taxonomy terms (with depth). Description in views should read something like
    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.
  5. Choose theVocabulary for the term you want to filter for.
  6. Choose theSelection type for how the user should interact with this filter.
  7. Then choose your Depth this is where you tell views how many children to included. The current description in views reads.
    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).
  8. Click Add
  9. The setting window will appear. Put a check in Expose this filter to visitors, to allow them to change it.
  10. Then Apply and save and done.

Please note that you can limit your available choices to the user if you select Dropdown instead of Autocomplete in the setting screen.

Good luck and ping me if need any help!

advan20092’s picture

How did you configure exposed filter to show only parents?

HyperGlide’s picture

@advan20092 which step are you stuck on from #1?

advan20092’s picture

HyperGlide, I think I sorted my issue, thank you very much

HyperGlide’s picture

np. and good luck.

Yazzbe’s picture

@ hyperglide, can you please describe how you created the exposed filter with parents only ?

HyperGlide’s picture

@yazzy008 -- same question -- which step are you stuck on from #1?

Yazzbe’s picture

@hyperglide, #1 is no problem. I have setup a vocabulary country > city and created an exposed filter so that you can select a country or city (one select box, I believe the same setup as you 5 parents & childs). The result will be a list of all related nodes to that specific country/city. But I need 2 select boxes/exposed filters: 1 for all countries (all parents) and 1 for all cities (related childs).

Irwin Nerwin’s picture

Wanted to do the same thing; searched; found this; tried it; it worked! It's not always that easy, but sometimes. Yay, Drupal pholks!

Simply: thanks!

Gauravk’s picture

This was good explanation of what i was looking since few days. Can't figure out how and where to display the child selection field?

I have car listing site, where Parent is Make and Child is Model. In search field i want user to select Make and then Model field should auto filter and show child available under that Make.

I stick Make field as explained above Has taxonomy terms (with depth) works perfect
I stick Model field as explained above Has taxonomy terms (with depth) works perfect

But how to interlink them to filter based on previous selection (parent)

hellobank’s picture

Excellent!

pdeo’s picture

Issue summary: View changes

Hello, I am new to Drupal and need some help. I need NLY PARENT terms to appear on the exposed filter (I have taxonomy defined as City>Locations within City). However, I have a search index on the content type and the view is based on the search index. Now, when I search on taxonomy while adding filter (Step 3) , I am unable to find (Taxonomy Terms with depth). I guess I am missing something basic here, can someone pls guide?

Pascal.s’s picture

Just want to share my solution... Maybe this can help some people here.
I use Simple hierarchical select. I created my Taxonomy terms, parents with there children. Then, i made a field (from that taxonomy term) in a content type. And then, This field become available in Filter Criteria as Content: Has taxonomy terms.
The result i get:
Image of hierarchical select
The children select menu appears after you select a parent item.

docans’s picture

I went through the steps above but it does not filter my taxonomies. I still see every child of every parent despite the fact that i set the depth to 1. Any advice.

Thanks

docans’s picture

Status: Closed (works as designed) » Needs work
docans’s picture

Version: 7.x-3.0-rc1 » 7.x-3.13
zietbukuel’s picture

I have the same issue as @docans all the child items are displayed no matter what depth I select.

Savannna’s picture

I have been looking for this. Works perfectly.

nigelwhite’s picture

Pascal.s #13. Thank you so much for pointing this out. It took me ages of trying all sorts, and failing, before your comment gave the solution I was looking for.

For any noob, like myself, if you want a Pascal.s result, start with a view of Content, not of Terms

renatog’s picture

Status: Needs work » Reviewed & tested by the community

Thank you @pascal.s

Your solution in #13 really helps a lot. Make sense.

Thank you very much.

renatog’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Hejar’s picture

when you expose filter, choose "limit list to selected items" then only select the parent terms.