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’.
$_productId = '166';
$_product = Mage::getModel('catalog/product')->load($_productId);
But, we can also load product by its attributes, like SKU. Assuming product sku to be ‘logitechcord’.
$_sku = 'logitechcord';
$_product = Mage::getModel('catalog/product')->loadByAttribute('sku',$_sku);
There is also another way to load product by SKU. Assuming product sku to be ‘logitechcord’.
$_sku = 'logitechcord';
$_catalog = Mage::getModel('catalog/product');
$_productId = $_catalog->getIdBySku($_sku);
$_product = Mage::getModel('catalog/product')->load($_productId);
Hope this helps. Thanks.