I created an "add to cart button" for a product at below location.


Now I want while clicking on the button, the product, should go into "cart". How can I do it? I am very new in Magento developer.So, please explain step by step, and also suggest me a better website and book for developement.

3 Answers 3


Use this code in


<?php $cart_url = Mage::helper('checkout/cart')->getAddUrl($_product);?>
<a href="<?php echo $cart_url;?>" >Add to cart</a>

you should look into addtocart.phtml file in:


This file has the Add to cart button.


i created "add to cart" button in below images /var/www/html/magento/app/design/frontend/rwd/default/template/catalog/product/list.phtml now i want while i clicking , product should add into "cart" how i can do please guide me step be step enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.