Discussions

Display Price Field in a View - Help

Hello everyone,

I am setting up a shop using DC and have hit a bit of a problem. I am using panels to override product displays and views to override taxonomy term displays. I have managed to get the price field into my product display node by adding additional contexts "Commerce Product from Node (on Node: Product" to the page variant.

The problem I now have is displaying the price field in the taxonomy term view, if I add a relationship to "Content: Referenced product" I end up with every product from the relevant term listed in the view when what I really want is just one product from each product display.

I'll try to simplify my point:

Products x,y,z are all basically the same product in different sizes and are displayed in product display 1.
My view is a table that contains: product title, product image, add to cart and "price field"

The only way I can find to access the price field in views is to add the relationship but when I do my view shows all three products which look like duplicates.

I really hope this makes some sense to you guys.

Is there any way around this ?

Posted: Sep 23, 2011

Comments

sleepingmonk on November 8, 2011

Seeking answers to the same question.

FOUND:
http://vimeo.com/22746978
http://www.drupalcommerce.org/node/174

--
I can build a view that shows product display nodes, based on Catalog taxonomy terms. As soon as I add a relationship with the Product reference I get duplicates when there are multiple SKUs on one product display node. So one item with 3 sizes will appear 3 times as individual items in the product grid. If I remove the relationship the duplicates go away. But without the relationship I can't access the price or image from the product entity.

Does anyone have an Ubercart style catalog (grid) happening with Commerce + Views?

Aussiejen on November 8, 2011

In the setting for the Product Reference, there is a checkbox "Attempt to combine like products on the same line item in the cart." Do you have that clicked?

sleepingmonk on November 8, 2011

I see that setting on the Field - Content: Product Reference, when I choose the "Add to cart" formatter. Checking or unchecking doesn't seem to make a difference. I don't get duplicates when I use this Field without the RELATIONSHIP.

Duplicates appear for each product referenced in the product display node when I add the Relationship, even if I check the "Attempt to combine..." on the field. Actually, I don't want the product reference field on this view at all. Just the product title, image and price on a grid, by category, linking to the product display node.

If you have a view that functions this way that you could export as an example, that would be great. The one I referenced earlier by Ryan just throws errors.

--
For now I'm attempting to achieve this goal with custom template overrides. Seems easier to write php than use views?!? Oh well, makes me more familiar with the new APIs.

Still... catalog out of the box would really help the Commerce project. If I come up with something good, I'll post it.