cancel
Showing results for 
Search instead for 
Did you mean: 

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

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

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,