cancel
Showing results for 
Search instead for 
Did you mean: 

How can i add Add-To-Cart Button on Blog Post page Products?

How can i add Add-To-Cart Button on Blog Post page Products?

My blog post contains products :

 

<div class="thumb col-md-2 col-xs-6" data-target="#carousel" data-slide-to="15">
<a itemprop="name" href="https://abc.com/apple">
<img class="img-responsive" alt="apple" src="https://abc.com/media/catalog/product/cache/1/image/700x700//9/1/111111111111001441-1.jpg" /></a><br />
<p>Apple</p>
</div>

<div class="thumb col-md-2 col-xs-6" data-target="#carousel" data-slide-to="15">
<a itemprop="name" href="https://abc.com/apple">
<img class="img-responsive" alt="apple" src="https://abc.com/media/catalog/product/cache/1/image/700x700//9/1/111111111111001441-1.jpg" /></a><br />
<p>Apple</p>
</div>

<div class="thumb col-md-2 col-xs-6" data-target="#carousel" data-slide-to="15">
<a itemprop="name" href="https://abc.com/apple">
<img class="img-responsive" alt="apple" src="https://abc.com/media/catalog/product/cache/1/image/700x700//9/1/111111111111001441-1.jpg" /></a><br />
<p>Apple</p>
</div>

How can i add appropriate add-to-cart link of my products

4 REPLIES 4

Re: How can i add Add-To-Cart Button on Blog Post page Products?

Hello @Aveeva,

Please use below code:

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

I hope it will work. If still you face any issue please let me know.

If it helps you, please accept it as solution and give us kudos.

Regards.

Re: How can i add Add-To-Cart Button on Blog Post page Products?

@Sarvagya Pandey  Thank You and sorry to keep track you can i get help regard my previous post, still override/rewrite not working.

Re: How can i add Add-To-Cart Button on Blog Post page Products?

If my this post helps you, please accept it as solution. Smiley Happy Regards

Re: How can i add Add-To-Cart Button on Blog Post page Products?

@Sarvagya Pandey  How can i add your code into https://snipboard.io/iXhezS.jpg