Skip to content

Instantly share code, notes, and snippets.

@bekapod
Created May 10, 2012 12:44
Show Gist options
  • Save bekapod/2652816 to your computer and use it in GitHub Desktop.
Save bekapod/2652816 to your computer and use it in GitHub Desktop.
MAGENTO: Seperate add product to cart button
<!-- replace <?php echo $_product->getId() ?> with your product id if you know it, if not then this snippet is to be used in a loop of products where $_product is a reference to the catalog/product model -->
<button onclick="location.href ='<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); ?>checkout/cart/add?product=<?php echo $_product->getId() ?>&qty=1'">Add To Cart</button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment