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.
Best Answer
Please change the moduleNamespace sv to Sv and change sv folder name to Sv
Also change model name to all lower-letter