0

I cannot seem to figure out why this observer is not firing. Any help is appreciated!

config.xml

<config>
<modules>
    <JP_OrderWaveIntegration>
        <version>1.0.0</version>
    </JP_OrderWaveIntegration>
</modules>
<global>
     <models>
        <JP_OrderWaveIntegration_Model>
             <class>JP_OrderWaveIntegration_Model</class>
        </JP_OrderWaveIntegration_Model>
    </models>
    <events>
        <checkout_cart_product_add_after>
            <observers>
                <JP_OrderWaveIntegration_Model>
                    <class>JP_OrderWaveIntegration/observer</class>
                    <method>addSale</method>
                </JP_OrderWaveIntegration_Model>
            </observers>
        </checkout_cart_product_add_after>
    </events>
</global>

Observer.php

<?php
class JP_OrderWaveIntegration_Sales_Model {

    public function addSale($observer) {
        Mage::log('My log entry', null, 'sales_observer.log');
        die('test');
    }
}
0

The convention for Magento 1 is to have the direct child node of <observers> the same as the module's identifier; in this case, it would be <JP_OrderWaveIntegration>.

Hoever, the larger issue is that your class is misnamed. Change the name to JP_OrderWaveIntegration_Model_Observer. Magento 1 uses the directory file system to specify names for classes (I believe that it conforms to the PSR-0 standard).

Please let me know if that works, or if you have any other questions!

  • This worked perfectly! Thank you! I had to change the class name in Observer.php and also as it was specified in config.xml – Joel Parker Dec 9 '16 at 16:22

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.