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.
2 Answers 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>
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– rchatburn2018年10月12日 09:41:04 +00:00Commented Oct 12, 2018 at 9:41
Explore related questions
See similar questions with these tags.
checkout_submit_all_afteronly appeared in Magento 1.4. What version are you running?