Drupal Questions & Answers

Ask and answer Drupal related questions! No question too simple or complex!
manatwo's picture
Asked by on Mon 26th Oct 2009
Displaying items with Views relationships and node reference

Hello all,
Let’s say I have these three sets of information: locations, trails, and trail types. The trail types can be a fixed taxonomy, the others have to be nodes so that more can be easily added and information attached (video, text, etc)

I need a view that will show different locations and display the trail types they offer, grouped by location. The way I have it set up now, locations and trails are tagged with a trail type taxonomy, and there is a node reference field on every location field referring to the different trails it has.

Here’s what I have set up now: A view that filters content types of “locations” and then a relationship with the trails node reference field. I can successfully enter a taxonomy term (for instance, “Long Distance”) and return locations with long distance trails and the long distance trails associated with those locations, grouped by location. The problem is displaying some of the content from the location node. If I put the location body as a field in my View, it returns the body from the location node for each trail instead of one for each location. It’s hard to explain, but here’s an idea of what the view result looks like:

NORTH CAROLINA [linked to the North Carolina node]
>Appalachian Trail
North Carolina is great!

>Benton McKaye Trail
North Carolina is great!

TENNESSEE
>Appalachian Trail
Tennessee is also great!

>Overland Trail
Tennesee is also great

Ideally, it would be:

NORTH CAROLINA
North Carolina is great!
>Appalachian Trail
>Benton McKaye Trail

TENNESSEE
Tennessee is also great!
>Appalachian Trail
>Overland Trail

Any ideas or advice are greatly, greatly appreciated.
David

Commenting on this Drupal Question is closed.