How To Load Product By SKU and Other Attributes in Magento

Thursday, 12. April 2012

A quick way to load product by sku in magento is by using the load and/or loadByAttribute methods of the product’s model class. Here are some examples

Load Product By loadByAttribute() method
The loadByAttribute methods format is like this

$product = Mage::getModel('catalog/product')->loadByAttribute('sku',$sku);

Load by the load() method

$product = Mage::getModel('catalog/product')->load($sku,'sku');


Leave a Reply

You must be logged in to post a comment.