Discussions

Views not displaying images for product content types

Greetings,

I am able to get my product images to display in views that use product content type. I imagine this requires some relationships setting which i can't seem to figure out. Can somebody tell me the relationship configuration within views to get data fields from product content type to show in the view? Many many thanks. Kevin

Posted: Aug 18, 2012

Comments

alx on August 19, 2012

I have content-type product display as a Filter.

Under "Advanced" (right)
I have Content:Product ( aka Content: Referenced product ) setup as a relationship.

Once the (Advanced) Relationship is setup I go to the Field settings (left).

I specify Product as a relationship in the Field settings for the image.

If it still doesn't work, try disabling "Disable SQL rewriting" under Advanced Sql Settings. I have it disabled, but now I am not sure if this is for another reason.

I think I have this working so images show but i have had less luck getting the product content type's taxonomy when using views to query the product display with a relation to the product type.

drupalability on August 20, 2012

Hi alx,

Thanks for the info. Yeah, I figured it out and it works. But now I have the same problem as you with taxonomy terms. They work on the node content type if i put the the field there... but not on the product content type. I think it is too much work to first create a product type and then have to go to the content type and add the terms. Let me know if you come up with a solution. Cheers Kevin

c.altosax on August 23, 2012

I applied the fix from above, which was very helpful. Although, the view is now not visible for anonymous users. I assume there must be some permission associated with this. Do you happen to know what it might be? The view is visible until I set the relationship to Content:product.

Also, is there a way to get the image to link to the product display? When set to link to content, it links to the product itself.

alx on August 28, 2012

The permissions issue might be related to SQL rewriting. I had the same problem, but now I can''t remember how fixed. Could the sql rewriting.

ALSO I think I figured out the taxonomy issue for accessing views->product display->product's taxonomy.

You already have a product relationship setup

1) Setup a new relationship with the taxonomy field but make sure to select the one that says

"Taxonomy term: Commerce Product using _____ <-- your vocabulary of interest
Relate each Commerce Product with a _______ set to the term. <-- your vocabulary of interest"
Require this relationship.

2) Now that the relationship is there go to the FILTER CRITERIA
Select the configure filter criterion: Taxonomy term: Term
require the relationship
with field_______ <--- your vocab of interest

The select the operator. e.g. is one of and the the terms you want to filter on.

====
Took me a long time to figure this out. I hope it sticks.