1

We're looking into adding a "Buy All" button for a Charity / Auction site and the owner would like to have a buy all button that would add all items (each having a stock of 1) to the cart for purchase.

Second Question: Is it possible to visibly show when a product has been added to the cart? The reason being is that the items for sale will be in a grid side by side and the owner would like a way for people to know which items they have added to the cart by visibly altering a div tag (or something similar) once the item is residing in the cart.

2

Buy All button:

Yes it is possible to add all items to the cart with a single button you would need to use the {exp:store:product_form} tag pair wrapped around your channel entries tag or Matrix/Grid or Relationship/Playa tag pair. Full documentation of the product_form tag can be found here.

{exp:store:product_form}
  {exp:channel:entries channel="products" dynamic="no" limit="5"}
      {exp:store:product disable_form="yes" entry_id="{entry_id}"}
          <!-- add to cart form / product details -->
    {exp:store:product}
  {/exp:channel:entries}
{/exp:store:product_form}

In cart:

You would want to use the {qty_in_cart} tag in the {exp:store:product} tag. Something along the lines of:

<div class="{if qty_in_cart}inCart{/if}">

Full documentation for this can be found here

| improve this answer | |

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.