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), and 2 content types which are named the same.
Both the content types provide the ability to check related items (a 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?
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | NAT 1 - relationship 1 - NAT Nid.png | 42.09 KB | knalstaaf |
| #3 | NAT 2 - relationship 2 - Tax terms on node.png | 69.17 KB | knalstaaf |
| #3 | NAT 3 - contextual filter - content id url - rel NAT node.png | 79.61 KB | knalstaaf |
| #3 | NAT 4 - query settings - distinct.png | 56.43 KB | knalstaaf |
Comments
Comment #1
knalstaaf commentedComment #2
knalstaaf commentedComment #3
knalstaaf commentedMy solution
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).
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.
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 EVA does something similar, both the method above works in both directions)
Comment #4
knalstaaf commentedComment #5
knalstaaf commentedComment #6
knalstaaf commentedAddendum:
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:
Can't remember if it would meet the requirements of the starting post, but it may be close.
Comment #7
mrpauldriver commentedThank you for this, saved my day,
After reading that a generated term can not be attached to the parent NAT node I was beginning to think that creating a view of related content based on a node title terms was not possible - https://www.drupal.org/node/155411