I have setup a view that displays a slideshow of pictures of various products on the top of the page. Built as described below....

A custom content type called "slideshow_image".
The content type has a single image field to store the image banner aka the "slide"
I also have a node reference field called "related product".
I create one "slideshow_image" node for every image banner.

The view has a block display that shows all the "slides", but now I want to make a new block that makes use of the "related product" field so that only the images that are related to the currently displayed product node are shown.

For example, I have 3 slides.
Slide 1 -> Related to Product A (node reference =node 1)
Slide 2 -> Related to Product A (node reference =node 1)
Slide 3 -> Related to Product B (node reference =node 2)

When I am on the page displaying Product A (node/1), only the slides that have the node reference to product A should be displayed.

How can I do this?

Comments

PawelR’s picture

you need to use current node nid as an argument for your nodereference field in the view, please go to 'Arguments', choose your nodereference field and choose 'Provide default argument:' radio button in 'Action to take if argument is not present:' and then choose 'Node ID from URL'

tuaris’s picture

That worked perfectly.

nevets’s picture

Add an argument on the reference field, configure to use default value, Node id (nid) from URL.

Drave Robber’s picture

What our distinguished colleagues said. :)

On a side note, one doesn't even need nodereference to create node-specific banners – they can well be part of the node itself. I once wrote a short howto on this: Views tricks: putting a field outside of a node
A slideshow would probably need some check-box checked here or there, but the principle still applies.

tuaris’s picture

I see what you did their, I suppose I could have done the same (just made a new product field named "banner"). I'll keep that in mind for something in the future.