Magento Ajax Based Add to Cart from category page

/ Published in: PHP
Save to your folder(s)

Copy this code and paste it in your HTML
  1. <p><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocationAjax('<?php echo $this->getAddToCartUrl($_product) ?>','<?php echo $_product->getId()?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
  3. <span id='ajax_loader<?php echo $_product->getId()?>' style='display:none'><img src='<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif')?>'/></span>


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.