What I'm trying trying to do sounds fairly simple, but I can't get my head around it.

I'm having 2 taxonomy vocabularies: machinery and batteries (both created with NAT for all that matters), and 2 content types which are named the same.

Both the content types provide the ability to check related items (a regular term reference field). For the machinery node the user can check which batteries are suitable, and for the battery node the user can check which machines use this battery.

Basicly what I'm trying to is: if you're on a page about a specific machine, it should show the batteries that are related to it, be it as teasers (or fields) in a block. And vice versa: when you're on a page about a specific battery, it would show all the machines in which it fits.

I've been boggling around with relationships and contextual filters, but it just wouldn't work out so far (spent a couple of hours here). Does anyone have an idea how to sort this out please?

2 Answers 2


There's possibly an easier way with the References module. In that case it wouldn't even require NAT, but just a View with contextual filter based on the Reference field.

  • Just saying there is a way is not an answer. Please describe that way.
    – Mołot
    Commented May 21, 2014 at 8:02
  • Actually it's pretty straight forward. 1) Provide a node reference field to the content type you want to display. 2) Use that field as a contextual filter in the View. Commented May 23, 2014 at 15:19

I can't summarize those instructions, MPD, you have to follow the exact steps or it won't work. Full instructions:

Create 2 content types, both correctly configured with NAT:


2 vocabularies, both will be filled along the way with terms generated by NAT:


Remark the difference in names, just to keep things clear in this explanation (so you don't mix up).

Add a "Term reference" field in both the content types. In het "Machinery" content type this field will refer to the "Batteries" vocabulary, and vice versa: the "Battery" content type has a term reference field that's linked to the "Machines" vocabulary.

Create the necessary nodes with both the Machinery and the Battery content type - which will generate terms in both the Machines and Batteries vocabulary.

Once this is done, check the right terms in each node: what batteries are related to this machine (for the Machinery nodes), and vice versa: in what machines does this battery fit (in the Battery nodes).

Once this is done, create a View and create a block in it. The block in this example will display related machines, being displayed on the page of a battery.

Set the format to whatever you like (HTML-list, unformatted, grid, ...). I'm using fields in this example (not content, but it should work as well).

Add the fields you'd like to show (Title, Image, ...)

Add the following filter: Content: type (=Machinery)

Now add 2 relationships:

  • NAT: Nid (Identifier: "NAT node")
  • Content: Taxonomy terms on node
    • Relationship: "NAT node"
    • Vocabularies: "Machines"
    • Identifier: "term"

Add a contextual filter:

  • File Usage: Entity ID
    • Relationship: "NAT node"
    • When the filter is not available: provide default value (Content ID from URL) Finally go to the Query settings of the View and check "Distinct" (to avoid duplicates).

Et voila, the first block is ready to go.

For the second block that will show associated batteries on a Machinery page, duplicate the block we've just created and modify the proper settings accordingly (content type filter, vocabulary in taxonomy terms on node).

You should be good to go - it works in both ways now.

I've add some screenshots in case they may be useful (with other names though than in this example, so don't get confused).

(Maybe the EVA module does something similar, both the method above works in both directions)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.