cancel
Showing results for 
Search instead for 
Did you mean: 

Add to cart button in product list from ajax page in root folder

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Add to cart button in product list from ajax page in root folder

Hi,

 

I have created one ajax page in my root folder to list all the products based on the filters. In that page I want ADD  TO CART button. Please help me to find a solution for this.

1 REPLY 1

Re: Add to cart button in product list from ajax page in root folder

Hi,

 

Are you included the Mage.php your individual file?

 

If yes, you can use this code:

<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="addtocart" onclick="setLocation('<?php echo Mage::getUrl('checkout/cart/add', array('product'=>$_product->getProductId(),'qty'=>1)) ?>')"/>

 

Regards,