Showing posts with label Placing custom add to cart button in magento. Show all posts
Showing posts with label Placing custom add to cart button in magento. Show all posts

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>