1

I am trying to write observer.for reference i am following below tutorial http://franklinstrube.com/blog/magento-event-observers/ . but my custom observer i not getting triggered. I am using Magento ver. 1.8.1.0 CE

my app/code/local/sv/ConnectInfusion/etc/config.xml file is as follows

<?xml version="1.0"?>
<config>
    <modules>
        <sv_ConnectInfusion>
            <version>1.0.0</version>
        </sv_ConnectInfusion>
    </modules>
    <global>
        <models>
            <ConnectInfusion>
                <class>sv_ConnectInfusion_Model</class>
            </ConnectInfusion>
        </models>
        <events>
                <checkout_submit_all_after>
                    <observers>
                        <awesome_example>
                            <class>sv_ConnectInfusion_Model_Observer</class>
                            <method>SyncWithInfusion</method>
                        </awesome_example>
                    </observers>
                </checkout_submit_all_after>
            </events>
        </global>
</config>

My Observer file is

app/code/local/sv/ConnectInfusion/Model/Observer.php

class sv_ConnectInfusion_Model_Observer {
    /**
     * This function is triggered by a Magento observer declared
     * in etc/config.xml
     *
     * @param Varien_Event_Observer $observer
     */
    public function SyncWithInfusion($observer)
    {
        // Your magic code goes here...
        $event = $observer->getEvent()->getControllerAction()->getFullActionName();

        Mage::log('Event Fired: ' . $event);
        Mage::log('yeah i am in observer !! it works' , null , 'mylog.log');
        die();
    }
}

and my app/etc/modules/sv_ConnectInfusion.xml file is as follows.

<?xml version="1.0"?>
<config>
    <modules>
        <sv_ConnectInfusion>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Mage_Checkout/>
                <Mage_Sales/>
                <Mage_CatalogInventory/>
            </depends>
        </sv_ConnectInfusion>
    </modules>
</config>

what i am doing wrong? I tried by changing the xml files, adding <depends> , i also tried to move the code in community directory but still no luck.

  • checkout_submit_all_after only appeared in Magento 1.4. What version are you running? – philwinkle Jan 8 '14 at 19:31
  • i am using Magento ver. 1.8.1.0 CE – ajinkya Jan 9 '14 at 5:42
  • Then find a event you want to use and use this, no event, no dispatching :D – Fabian Blechschmidt Jan 9 '14 at 6:47
2

Please change the moduleNamespace sv to Sv and change sv folder name to Sv

Also change model name to all lower-letter

<?xml version="1.0" ?>
<config>
    <modules>
        <Sv_ConnectInfusion>
            <version>1.0.0</version>
        </Sv_ConnectInfusion>
    </modules>
<global>
    <models>
                <connectinfusion>
                    <class>Sv_ConnectInfusion_Model</class>
                </connectinfusion>
            </models>


        <events>

                <checkout_submit_all_after>
                    <observers>
                        <awesome_example>
                            <class>Sv_ConnectInfusion_Model_Observer</class>
                            <method>SyncWithInfusion</method>
                        </awesome_example>
                    </observers>
                </checkout_submit_all_after>
            </events>
</global>
</config>
4

checkout_submit_all_after is replicated for Magento CE 1.8x and you can use checkout_type_onepage_save_order_after event in Magento CE 1.8x

  • You sir have just saved my keyboard from a trip out of the window! – rchatburn Oct 12 '18 at 9:41

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.