Magento exception 'Varien_Exception' with message 'Invalid method Mage_CatalogRule_Model_Rule::loadProductRules

  • Posted on: 6 January 2015
  • By: markus.wilhelm

Dear all,
after I updated my shop to Magento CE 1.9.1 I was unable to save any product. After searching a while I found the problem must be anywhere arround price rules but I could not find a solution. A quick fix was to uncomment the function Mage::getModel('catalogrule/rule')->loadProductRules($product), I do not use price rules anyhow.

in /...//lib/Varien/Object.php:653
Stack trace:
#0 /...//app/code/core/Mage/CatalogRule/Model/Observer.php(72): Varien_Object->__call('loadProductRule...', Array)
#1 /...//app/code/core/Mage/CatalogRule/Model/Observer.php(72): Mage_CatalogRule_Model_Rule->loadProductRules(Object(Mage_Catalog_Model_Product))
#2 /...//app/code/core/Mage/Core/Model/App.php(1338): Mage_CatalogRule_Model_Observer->loadProductRules(Object(Varien_Event_Observer))
#3 /...//app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Mage_CatalogRule_Model_Observer), 'loadProductRule...', Object(Varien_Event_Observer))
#4 /...//app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('catalog_product...', Array)
#5 /...//app/code/core/Mage/Core/Model/Abstract.php(391): Mage::dispatchEvent('catalog_product...', Array)
#6 /...//app/code/core/Mage/Catalog/Model/Abstract.php(315): Mage_Core_Model_Abstract->_beforeSave()
#7 /...//app/code/core/Mage/Catalog/Model/Product.php(515): Mage_Catalog_Model_Abstract->_beforeSave()
#8 /...//app/code/core/Mage/Core/Model/Abstract.php(316): Mage_Catalog_Model_Product->_beforeSave()
#9 /...//app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php(728): Mage_Core_Model_Abstract->save()
#10 /...//app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_Catalog_ProductController->saveAction()
#11 /...//app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('save')
#12 /...//app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#13 /...//app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#14 /...//app/Mage.php(684): Mage_Core_Model_App->run(Array)
#15 /...//index.php(87): Mage::run('', 'website')
#16 {main}

public function loadProductRules($observer)
    {
	/** @var Mage_Catalog_Model_Product $product */
        $product = $observer->getEvent()->getProduct();
        if (!$product instanceof Mage_Catalog_Model_Product) {
            return $this;
        }
        //Mage::getModel('catalogrule/rule')->loadProductRules($product);
        return $this;
    }

New: