I have created a module to change the prices of a product when added to cart, but the module doesn't get to the method.

The observer.php file and the class Zain_ProductLabelPricing_Model is running but the method 'modifyPrice' is not. Can someone guide me how to fix this?


<?xml version="1.0"?>



// die(); this is working
class Zain_ProductLabelPricing_Model {
    public function modifyPrice(Varien_Event_Observer $obs) {
        //die(); this is not working
        Mage::log('This worked');

2 Answers 2


Your event configuration is looking for the model Zain_ProductLabelPricing_Model_Observer. This is derived from chdispatcher/observer which is translated to: module/model.

Just add _Observer to your class name and place the file in the folder Zain/ProductLabelPricing/Model with the filename Observer.php.


The class must be named Zain_ProductLabelPricing_Model_Observer

The only reason, why your die() is executed, is that Magento loads Observer.php to look for this observer class. It does not find it, so the next thing that happens is a "class not found" error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.