Magento Product object and loadByAttribute

English
,

Hi Folks,

A little note to work with product object in Magento:

1
2
3
4
5
6
7
/**
 * Using setStoreId two times, otherwise it will save the data to default store
 */
$product = Mage::getModel('catalog/product')
    ->setStoreId($storeId)
    ->loadByAttribute('ean', $ean)
    ->setStoreId($storeId);