I have a custom script that outputs a list of particular products in csv format. The frontend of the store just runs fine, however when retrieving the price of a product in my script, the actual FinalPrice does not take my catalog price rules into account, which is kind of messed up, since the getFinalPrice() method works perfectly in template files ect..
This is my code, which I have drastically shortened for demonstration purposes:
<?php
require 'app/Mage.php';
Mage::app('default');
$product = Mage::getModel("catalog/product")->load(27809);
echo $product->getFinalPrice();
?>
This outputs the product’s regular price, but not the price accounted for the catalog price rule. I have just applied all catalog rules again and have also rebuilt all indexes. As I said, the discount prices show fine in the frontend, but for some reason I am not able to retrieve them in my script.
I hope someone has an idea what could be going wrong here. Thanks in advance!
Product final price is calculated in an observer, and your script is not loading the events configuration.
See my addition below.
See
Mage_CatalogRule_Model_Observer::processFrontFinalPrice();.