Magento load product by SKU

02.Sep.2012

Sometimes you need to get product by its attribute SKU. To do this, you can simply use following snippet and you will have Magento to load product by SKU.

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