Jump to content

Add to cart button to "detect" accessories in a product HELP!


Recommended Posts

HI, I wonder how would be possible to change the code around the "add to cart" button so it checks if the product added is an accessory or just a product itself... maybe an if statement? but how? dont know that much coding yet :D

 

Im still working on my idea of getting a "Request a sample" so the idea behind this will be to add an extra button that checks for the accessories and if true, then the product will be added free of charge in order to create the samples ordering system. Any ideas? Many thanks,,.,,,

Link to comment
Share on other sites

I found this on a web.....

 

 

{if $groups|@count == 1}

<div id="attributes_buttons">

<script>

$("#attributes").css('display','none');

$("#add_to_cart_hide").css('display','none');

</script>

{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>

{/foreach}

{/foreach}

<p></p>

</div>

{/if}

 

Check the web http://test.presto-changeo.com/music-ipods/2-ipod-shuffle.html as a demo....

 

HOW can I change the code to add the price "0" to these?? it will be easier if i could change attributes for accessories because they already have no price... but i dont know that much... I could make this code work if i just knew how to tell it to add productprice 0

Link to comment
Share on other sites

×
×
  • Create New...