Magento Product Price Is Zero with Catalogue Price Rule

We have come across a somewhat critical core code error in Magento versions less than 1.5 when using the "Fixed Amount discount". Any SKU that the respective rule applies to results in the final sale price of the product being £0. This seems to only occur in certain scenarios, but is easily replicated on a Magento 1.4.2.0 clean demo store.

The fix

Rather than posting the full code for an extension based override, we're just going to post the code snippet and the simpler PHP autoloader priority based fix using the ./app/code/local directory.

Create ./app/code/local/Mage/CatalogRule/Helper/Data.php

And paste the following code inside:

class Mage_CatalogRule_Helper_Data extends Mage_Core_Helper_Abstract
{
public function calcPriceRule ($actionOperator, $ruleAmount, $price)
{
$priceRule = 0;
switch ($actionOperator) {
case 'to_fixed':
$priceRule = $ruleAmount;
break;
case 'to_percent':
$priceRule= $price  $ruleAmount / 100;
break;
case 'by_fixed':
$priceRule = $price - $ruleAmount;
break;
case 'by_percent':
$priceRule = $price  (1 - $ruleAmount / 100);
break;
}
return $priceRule;
}
}

Save your file, flush your cache and re-apply your catalogue price rule.

[syntaxhighlighter]