Management of root and leaf items in taxonomy vocabularies

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
bellHead's picture

I have been making friends with Views quite rapidly over the past week having previously used custom developed modules possibly a little too much.

I'm finding it difficult to manage the behaviours required at the root and leaf of a hierarchy which are different from the middle of the structure. I would like to contribute some additions but would first like some feedback on whether the changes would be in line with the Views project in general and which of the possible routes would be least painful to develop.

I'm creating a product catalog, although it is a generic directory problem really. There are root items (with no parent / 0 parent) and a variable depth hierarchy. Let's take wines for an example

Red
- Varietals
- Shiraz
- [products]
- Cabernet Sauvignon
- [products]
- Cabernet Franc
- [products]
- ...
- Blends
- Bordeaux
- [products]
- Rhone
- [products]
- Cape
- [products]
- ...
Rose/Blush/Blanc-de-noir
- Varietals
- Shiraz
- [products]
- Cabernet Sauvignon
- [products]
- ...
- White / Red blends
- [products]

and so on ...

In my current specific case I am lucky enough not to have term names repeated anywhere in the vocabulary, making it a bit simpler than the example.

Unlike a normal taxonomy view, or the results produce with the combination of views and pathauto I would like to display child terms at each level with their associated images (being able to field a vocabulary is great).

There is a workaround for the problem at the leaf end, although it's a little clumsy. The real problem arises at the root. There does not appear to be a way to get a view of of the root items when using the "Term name converted to Term ID" validation. With basic or numeric validation you can use 0 as a default but it fails validation.

What I would like to try to build as a solution to this is default option or an action for failed validation to "Filter for root members of the vocabulary". Which one to go with depends on whether it would be desirable to have bogus paths into the vocab return the root items (as would happen with a failed validation action) or not. As well as the feasibility of the approaches of course :)

For the leaf end of the tree the option I think the neatest answer would be a fallthrough on empty to an alternate URL. So that /catagories/foo would fall though to /products/foo if foo had no child terms.

Thoughts?

Views Developers

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week