We have an observer that modifies final price, that's triggered on the event catalog_product_get_final_price
. Problem is, when you retrieve products via collection with addAttributeToSelect("*")
, they come back with a final_price
already set, and the product getFinalPrice
function merely returns what's in the database instead of recalculating (and running the observers for) the final price.
Mage_Catalog_Model_Product
public function getFinalPrice($qty=null)
{
// *** Collection items already have a 'final_price' from flat tables
// but it's wrong because observers haven't run yet ***
$price = $this->_getData('final_price');
if ($price !== null) {
return $price;
}
return $this->getPriceModel()->getFinalPrice($qty, $this);
}
I've also noticed that all of our custom attributes are also not being interpreted (we save things as JSON but decode into objects them on product load before using them).
This behavior doesn't happen when you load the product directly -- all the observers and models are interpreted when the product is loaded.
Is there a way to ensure the data we're retrieving from a collection matches in format and value the data we would retrieve if we load the product directly?
I know I can just load the product individually to trigger all of the events that go along with it, but in the case of 3rd party software, that might not always be the case and the final price is wrong.
We're on version 1.7 if it helps.