1

When I try to use a Commerce Product Reference field in any view with a link to content, it links to the -admin- for the product, not the content.

This was discussed for the images here: https://www.drupal.org/node/1970482

But I'm finding that this will happen if you try to create a link wrapper to -any- Commerce Product field. (SKU, Title, etc.)

So.. can someone point me to the place in the Commerce code where that URI is generated so I can override it?

I thought it was in commerce_product_reference.module but I can't figure it out.

  • To link the content page, don't use refrence field. Instead use content field directly like content path or link. – Bala Oct 16 '14 at 0:11
1

I was facing this problem also in the latest Kickstart 2 version, so after hours of investigating I was able to prepare those detailed steps how to solve it:

  1. In Views under 'Advanced' and the 'Relationship' heading choose 'Add', and find and select 'Content: Referenced Product' (if adjusting a cart form view, then select 'Commerce Line item: Product'). Check the 'Require this relationship' checkbox.

  2. Now, under 'Fields' heading add a field 'Content: Path' (in case of the cart form view, add 'Commerce Line item: Display path'). 'Exclude from display' this field and arrange it to be the first field (it is important to have this field above the image field in order to be able to use its [path] token (see point 3)). If you have a multilingual page, check 'Use absolute link' under 'Rewrite results' (matters for the 'Content: Path field' only).

  3. Finally, add the 'Product: Images' field. Link it to Nothing. Under 'Rewrite results' choose 'Output this field as a link' and use the token [path]. If you are facing the problem also with other fields, apply this solution also to them.

Source: Me and https://drupalcommerce.org/discussions/556/product-image-views-link-product-admin-rather-product-display-page

1

Please see my answer at https://www.drupal.org/node/1970482#comment-9252269 and try to avoid posting the same support request in multiple support forums.

0

You can add the path alias of the products display to your view, check the box to hide the field. Then rewrite your product reference field to link to path.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.