Articles Archive for November 2013
Magento »
Here is a quick code to get / load product by its SKU in Magento.
Generally we load product by its ID. Assuming product id to be ‘166’.
1 2 | $_productId = '166'; $_product = Mage::getModel('catalog/product')->load($_productId); |
Magento »
Here is a quick code to get add to cart url of any product.
Suppose that we are fetching add to cart url of a product with id ‘166’.
1 2 3 | $_productId = '166'; $_product = Mage::getModel('catalog/product')->load($_productId); $_url = Mage::helper('checkout/cart')->getAddUrl($_product); |
Mukesh Chapagain is a graduate of Kathmandu University (Dhulikhel, Nepal) from where he holds a Masters degree in Computer Engineering. Mukesh is a passionate web developer who has keen interest in open source technologies, programming & blogging.