3

I have two content types: sector and product. Both share terms from the same vocabulary, called branch.

A sector node should list all product nodes that share the same term(s) (from the branch vocabulary).

I managed to set up a view that does what it should: each sector node shows related product nodes. I did this by doing the following (sharing this because this may help others):

  1. First of all: make sure that, eventhough both content types use the same vocabulary, each content type has a different taxonomy field that refers to the same vocabulary. For the sector content type we'll call the (taxonomy) field "rel sector", the (taxonomy) field of the product content type we'll call "rel product". Both point to the same vocabulary: branch.
  2. Create a block display in your (content) View.
  3. Add a contextual filter: Content NID (default value: content-ID from URL).
  4. Add a relationship: taxonomy terms on node (check the commonly used vocabulary).
  5. Add another relationship: Taxonomy term: Content that uses "rel product". Tie it to the previously created relationship (relation: term, for instance). Make it required.
  6. Configure the Query settings as follows: distinct (to avoid duplicates)
  7. Open the title field, and tie it to the second relationship (which in this case would be field_rel_product).

Important:

  • Make sure not to have a filter criterion based on content type in your view display, or it will actually block the content you'll need.
  • Again, make sure that, eventhough both content types use the same vocabulary, each has a different field that refers to the vocabulary.

This works perfect when using common taxonomy terms on one level ànd it works with child terms as well, but in that last case it's required to have all those child terms checked when displaying a parent node. And that's exactly what I want to eliminate.

What I'm after is that it should suffice to check the a parent term, and all its children would be displayed as well, without them being checked necessarely.

It's not such a big deal if this isn't possible by design, but could anyone provide the finishing touch if it is please?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.