Tuesday, 15 March 2016

Adding Custom add to cart button in Magento


Adding Custom add to cart button in Magento

Put below code into your .phtml file.

$productId = '168';   // Your Product Id
$_product = Mage::getModel('catalog/product')->load($productId);

<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo Mage::helper('checkout/cart')->getAddUrl($_product); ?>')"><span><span><img src="<?php echo $this->getSkinUrl('images/buy.jpg') ?>" alt="" /></span></span></button>

3 comments:

Gowthaman said...

Hello brother

i want product list page add to cart button for configurable product..

with options

please help me....

Anonymous said...

Saved as a favorite, I like your blog!

Simranjeet Singh said...

where to put this code?