Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello, I have my products organized in Categories and Subcategories using Taxonomy.
The subcategory's taxonomy view display's it's products and they have as a field Commerce's 'add to cart form'.
The product is correctly placed on the cart as a line item but it's 'Display Path' field is bland and hence it does not link to it's node, whereas if it's added to the cart via it's node, it works like a charm.
I don't know if this is working as intented, but if it is I'd like some pointers on how to override it. Thanks!
Comments
Comment #1
magtak CreditAttribution: magtak commentedsame question in DSE: http://drupal.stackexchange.com/questions/21733/commerce-views-taxonomy-... in case you wanna answer there too :)
Comment #2
amateescu CreditAttribution: amateescu commentedYou need to check this option in the 'Add to cart form' field settings: "Link products added to the cart from this View to this View's path if displayed as a page."
Comment #3
magtak CreditAttribution: magtak commentedWrong. That will lead to the view, not to the product. (Plus for some reason it doesn't work but that's another story).
Comment #4
magtak CreditAttribution: magtak commentedComment #5
magtak CreditAttribution: magtak commentedfound a possible/probable duplicate that seems still unresolved: http://drupal.org/node/1399434
Comment #6
rszrama CreditAttribution: rszrama commentedThe 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.
Comment #7
magtak CreditAttribution: magtak commentedI see. Thanks Ryan! :D
Comment #8
magtak CreditAttribution: magtak commentedAnd confirming it worked! Thanks!
Comment #9
rszrama CreditAttribution: rszrama commentedGreat, glad to hear it.
Comment #11
spinsheet CreditAttribution: spinsheet commentedCan you please explain what you mean by
I am using Organic Groups and have the View og_my. I would like to put an 'Add to Cart' Link in there that will at a predetermined product to the buyers cart.
I was looking in fields trying to find a field that corresponded to what you said about the Product Reference Field but am not coming up with anything.
Comment #12
rszrama CreditAttribution: rszrama commentedYour case is quite different, especially since an OG now is not a group. In the case of this issue, the site is using a node with a product reference field to show products for sale on the front end, so my comments were pertaining to how to present those nodes in a View to preserve the product display path in the product line item created when the product was added to the cart.