How to load only a specific attribute instead of loading all attributes in magento 1.9? I'm using the code below, but it loads all the information and I just need the product ID.

Mage::getModel('catalog/product')->loadByAttribute('sku', $_customOptions['simple_sku']);
  • Did you try with addAttributeToSelect("*")?
    – S.P
    Apr 22 at 16:59

2 Answers 2


Try below code,

$sku = 'some-sku';
$productId = Mage::getModel('catalog/product')->getIdBySku($sku);

Thanks & Regards,


If you want to return entity id from sku then magento have already function

getIdBySku($sku) for it.


$sku = 'some-sku';
$productId = Mage::getModel('catalog/product')->getIdBySku($sku);
echo "your product id" . $productId;   

You can also get single column value with getColumnvalues. may be it would return with array format.



Magento also provide reset for select only specific field.

$collection = Mage::getModel('catalog/product')->getCollection();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.