Certified Partner and
PrestaShop Developer for:

Multiple Add to cart buttons instead of one attribute group items.

Multiple Add to Cart Buttons

This page was written in English, please see the English version for the most accurate code.

This Modification lets you display a new "Add to cart" button for each attribute group item so it can be easily added to the cart without having to choose from the drop down.

For a Demo see
It will only apply itself if there is only 1 attribute group set.

These changes are made to /themes/prestashop/product.tpl around line #282

1) Add a div around the “add to cart” button, so we can hide it.

<div id="add_to_cart_hide">
<p{if !$allow_oosp && $product->quantity == 0} style="display:none;"{/if} id="add_to_cart" class="buttons_bottom_block"><input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" /></p>
2) Create the new buttons , they will be called “Add (item name) to cart”

In the code it’s Add {$group_attribute|escape:‘htmlall’:‘UTF-8’} to cart, you can change that if you need to.

You can add this code right below the one above, or anywhere else you would like the buttons to appear.

{if $groups|@count == 1}
<div id="attributes_buttons">
{foreach from=$groups key=id_attribute_group item=group}
{assign var='groupName' value='group_'|cat:$id_attribute_group}
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<p class="buttons_bottom_block"><input onclick="document.getElementById('group_{$id_attribute_group|intval}').value = {$id_attribute|intval};findCombination();ajaxCart.add( $('#product_page_product_id').val(), $('#idCombination').val(), true, null, $('#quantity_wanted').val(), null);" type="button" name="Submit" value="Add {$group_attribute|escape:'htmlall':'UTF-8'} to cart" class="exclusive" /></p>