Tags/topics: 
3
Answers
Vote up!
0
Vote down!

How do I configure a views block with an "add to cart" button that will show the product currently being displayed?

I am trying to set up a site offering travel packages and would like to have a views block in the sidebar on the product display page similar to what these guys have done - www.cascada.travel/Tour/Epic-Patagonia-Multi-Activity-Adventure

I have created the views block but am trying to configure the contextual filters/relationships to show only the product that is currently being displayed on the page.

I assumed that adding "Commerce Product: Product ID" to the contextual filters, and "Provide default value" and using "Content ID from URL" would do it but no such luck.

Can anyone point me in the right direction?

Thanks!
Tim

Asked by: twooten
on February 9, 2013

3 Answers

Vote up!
0
Vote down!

I'm pretty sure this will work for you...

Remove your "Commerce Product: Product ID" contextual filter then add a new filter using "Content: Nid"

Then add a relationship for "Content: referenced product" (I have "require this relationship" disabled, but your needs may vary).

That should do it.

This is adapted from this helpful recipe: http://drupal.org/node/1841004

Answer by: banoodle
Posted: May 24, 2013
Vote up!
0
Vote down!

I've been scratching my head and could use a little guidance—can't seem to get contextual filters such as you describe to work either with products. Did you figure this out?

Answer by: alec
Posted: Jan 18, 2014
Vote up!
0
Vote down!

I just figured it out. First a the relationship "Commerce Product: Referencing Node" needs to be added. Then, the Contextual Filter of "Content: NID" can be used with "Provide default value" and "Content ID from URL".

Answer by: alec
Posted: Jan 18, 2014