3

I am constructing an e-shop using Drupal Commerce. I've arranged my products in Categories and Subcategories using taxonomies and taxonomy-menu. All is nice till now. I also created a view, that displays the subcategory's items, with an 'Add to cart' form as a field.

Clicking the 'Add to cart' button does adds the item to the cart.

The cart's block is is configured to link each line item to it's display path.

The issue occurs here: products added from their perspective nodes, are linked correctly (to their perspective display paths) in the cart. Products that were added via the view's 'Add to cart' button, are plain text, and their 'Display Path' field is empty.

I'm puzzled. Any help?

1

Instead of rendering fields including the 'add to cart' form as a field, try rendering the full node using a particular view mode which includes the 'add to cart' form. See http://drupal.org/node/1399434#comment-5450456

  • That should work indeed but I find it kind of an ugly workaround to something that should be rather simple, the bug occurs cause the "Display Path" field is empty, if I find a way to populate that, my work is done. – magtak Feb 8 '12 at 8:47
0

Quoting Ryan from the Commerce Guys that answered the question clearly in Drupal.org (http://drupal.org/node/1430146#comment-5577538):

"The problem is the "Add to Cart form" Views field that you're using doesn't have the node context. As far as the node and the View are concerned, that View is the sole place you're displaying that Add to Cart form. What you'd really need to do is to have the actual Product Reference field from the node rendered. When that happens, Views will load the full node and its field will be rendered individually - and it's during that process that it adds the node context to the Add to Cart form for use in the display_path field."

And problem solved!

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.