Magento Catalog Price Rules bugs

Magento's "Catalog Price Rules" was always a buggy experience, ever since magento 1.3... I don't know what's going with the development, but it's still buggy up to 1.4.1 ...

So here are a couple of fixes I found.

Magento 1.4.0.1:

source: http://www.magentocommerce.com/boards/viewthread/194930/#t245120

1. Open up Observer.php in /app/code/core/Mage/CatalogRule/Model/
2. Find the dailyCatalogUpdate() method
3. At the end of the method, before “return $this;”, add:
$this->applyAllRules( $this );
4. (Not sure if this step is necessary) Open up /app/code/core/Mage/CatalogRule/etc/config.xml
5. Find the crontab > jobs > catalogrule_apply_all area
6. Change
<cron_expr>0 1 * * *</cron_expr>
to something more frequent than daily, perhaps every hour
<cron_expr>0 * * * *</cron_expr>

Magento: 1.4.1

source:

http://mandagreen.com/fixing-catalog-price-rules-cart-issue-in-magento-1-4-1-0/

1 – create the following folders in your Magento distro: app/code/local/Mage/CatalogRule/Model
2 – copy app/code/core/Mage/CatalogRule/Model/Observer.php to app/code/local/Mage/CatalogRule/Model
3 – open the new/copied file and go to line 105. Change this code:

if ($observer->hasCustomerGroupId()) {
    $gId = $observer->getEvent()->getCustomerGroupId();
} elseif ($product->hasCustomerGroupId()) {
    $gId = $product->hasCustomerGroupId();
} else {
    $gId = Mage::getSingleton('customer/session')->getCustomerGroupId();
}

to:
if ($observer->hasCustomerGroupId()) {
    $gId = $observer->getEvent()->getCustomerGroupId();
} elseif ($product->hasCustomerGroupId()) {
    $gId = $product->getCustomerGroupId();
} else {
    $gId = Mage::getSingleton('customer/session')->getCustomerGroupId();
}

To be more precise, you have to change hasCustomerGroupId to getCustomerGroupId on line 105.

Tags: magento