I can get product attributes efficiently without loading the entire product by using:
Mage::getResourceModel('catalog/product')->getAttributeRawValue($productId, 'attribute_code', $storeId);
However, I can only do this with the price
'attribute, since final_price
is technically not an attribute. Since I'm grabbing a few hundred products on one page load, and the only data I need is the product's final price, doing this is very inefficient:
foreach($productIds as $productId) {
$finalPrice = Mage::getModel('catalog/product')->load($productId)->getFinalPrice();
....
}
Since I'm loading the entire product. If anybody can suggest a more efficient way, I would really appreciate it. Cheers!
Best Answer
"a more efficient way" is to use product collcections where final price is already add to. Some numbers here: What is faster - getting raw attribute value or use collection?
Using
->addFinalPrice()
will add something like this to collection query ...and
I'd us a colletion like
compared to