Closed (outdated)
Project:
Commerce Core
Version:
7.x-1.x-dev
Component:
Views integration
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
20 Feb 2012 at 07:25 UTC
Updated:
4 Jul 2025 at 12:00 UTC
Jump to comment: Most recent
Comments
Comment #1
rszrama commentedIf the image field is rendered with the Node context, it should link to the node itself; in Views this means you can't just add the relationship to the product and show the product image, because as far as Views is concerned at that point it only knows about the product entity. However, you're just stuck with a different sort of workaround - you have to make the View show node teasers (or some other node view mode) that includes the inject product image field. In that case, it'll link to the node as expected.
The code for this is in commerce_product_reference_commerce_product_uri() in the Product Reference module, since it's only through that module that we know if a product's image field is being rendered into a node context. I don't know of an easy way to do this with Views (which is why it isn't done yet : ), but let's make this into a feature request to see if we can actually alter the Views output on a row-by-row basis to change these links if we can determine a row represents a node or something. I'm sure there's a way, just a question of how difficult it will be to find it.
Let me know if I misread your report.
Comment #2
batigol commentedI did got exactly the same problem. You can create 2 type of views - content and commerce. You can set up images of both to be a link to the product itself. EDIT:(@webchick I did not read all your comment sorry, not even a commenter name :) I'm sure you exactly know how to set this up, maybe those instruction will help somebody else).
CONTENT:
You need to create a content type with product reference. Then in view add a Relationships - Content: YOUR_CONTENT_TYPE Reference (Product). Then simply add (Product) Commerce Product: YOUR_PRODUCT_TYPE Product Image. By adding Content: Path and Check - Exclude from display and Uncheck - Create a label. Move it to the top Fields list. Again go to the (Product) Commerce Product: YOUR_PRODUCT_TYPE Product Image click REWRITE RESULTS - check Output this field as a link and put there simply '[path]' token and check Use absolute path also.
You are done, your product images link to the product itself :)
COMMERCE PRODUCT:
You need to create a content type with product reference. Then in view add a Relationships - Commerce Product: Node referencing products from YOUR_FIELD_WITH_product_reference. Add Commerce Product: YOUR_PRODUCT_TYPE Product Image, (Node referencing products from YOUR_FIELD_WITH_product_reference) Content: Path and set as before.
You are done, your product images link to the product itself :)
BUT now there is bigger problem. If you have few variation of you product - like you have product T-shirt and you have blue T-shirt product, red T-shirt product, Yellow T-shirt product all of those product will display with their images. Instead you need only the first product to be displayed (the node product). Client shout click this product and there select proper product variation.Hands down... I can't set this up... This is the biggest issue with Commerce for me ATM (with http://drupal.org/node/1446000 EDIT: and http://drupal.org/node/1276450). I hope some drupal guru will point a direction here. Actually this is something that makes some those commerce technical and design advantages not to be used.EDIT2: After few hours I have menage it to work !
There are 2 options to not display product variations - first is (http://drupal.org/node/1200536#comment-4957410) to use aggregation. You need to set Aggregation type to Minimal for your image and title. To display your images change the Group column from fid to Entity ID.
But cause of (http://drupal.org/node/1219054) body problem with aggregation I prefer second solution (http://drupal.org/node/1200536#comment-5452090) add a filter for the product reference field and set the delta = 0 (Is equal to: 0)
So now only http://drupal.org/node/1446000 stops me for setting my store !
Comment #3
jsacksick commented