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.
Hi,
When you use display suite and change from node > manage display > basic layout to something else (for example "Fluid two column") "add to cart" doesn't show on the node anymore. How can you get this to "add to cart" on every layout? Should it be done via template.php or..?
Comments
Comment #1
Alex Dicianu CreditAttribution: Alex Dicianu commentedHi,
I've checked and indeed the "Add to cart" does not appear in the list. It's actually a normal behavior because the button isn't a field and so it will not appear in the fields list. I will try to fix this for the next release.
Thanks.
Comment #2
kaizerking CreditAttribution: kaizerking commenteduse Renderable elements module you will get all the elements available
Comment #3
P.Selfin CreditAttribution: P.Selfin commentedThanks, but how to use?
Comment #4
kaizerking CreditAttribution: kaizerking commentedThere is link on the project page on how to use. one you enable it you get a link on every page , :manage display, which will register the form to mange the display, then it will be available in display suite and also on its own manage display which lists all the registered forms. registering means just enabling to manage
Comment #5
tomchy CreditAttribution: tomchy commentedSubscribe!
I don't find the Add to cart button in the renderable elements...
Comment #6
lolandese CreditAttribution: lolandese commentedThe Renderable elements module didn't solve anything in my case. The "manage display" is shown only on forms, not on nodes.
Instead I used another workaround by creating a block View with only the Add to cart button as a field and the node ID as contextual filter. Remember to "Provide a default value" "when the filter value is not available" of the type "Content ID from URL".
After this create a custom Block field in DS using the block View you just created.
Thanks.
Comment #7
P.Selfin CreditAttribution: P.Selfin commentedSimple Solution
In Display Suite -> admin/structure/ds/fields > Add a code field >
<div class="basic-cart-add-to-cart-my"><a id="basic-cart-add-to-cart-link-my-[node:nid]" class="button basic-cart-add-to-cart-link-my" href="/cart/add/[node:nid]">Add to cart</a></div>
> Token - Toggle this checkbox if you are using tokens in this field.
And you have new field :)
Comment #8
lolandese CreditAttribution: lolandese commented#7 answers the question.
Thanks.
Comment #10
zpolgar CreditAttribution: zpolgar commented#7 is partly ok, because the add to cart link don't appear in the right place. In DS the price field is before but when it shown "Add to cart" link is before Price field.
Comment #11
kerrycurtain CreditAttribution: kerrycurtain commented#7 worked for me but to get the button to actually add to the cart I did have to add the full site URL to the href like so...
href="http://www.mysite/cart/add/[node:nid]"