I created my own module in magento in app / code / local / mycustom / GeoLocation, in that I want to create an observer, so I followed a lot of tutorials, and finally I created the code below to name it on each download pages are magento, but still it does not call my user module observer.php. I am new to magento, so please help me.
config.xml
<config>
<global>
<events>
<cms_page_render>
<observers>
<mycustom_GeoLocation_Model_observer>
<type>singleton</type>
<class>mycustom_GeoLocation_Model_Observer</class>
<method>getGeoLocation</method>
</mycustom_GeoLocation_Model_observer>
</observers>
</cms_page_render>
</events>
</global>
</config>
mycustomGeolocation_Event.xml to enable the module
<config>
<modules>
<mycustom_GeoLocation>
<active>true</active>
<codepool>local</codepool>
</mycustom_GeoLocation>
</modules>
</config>
Finally, my observer.php, which is present in my user module model
class mycustom_GeoLocation_Model_Observer {
public function __construct()
{
}
public function getGeoLocation(Varien_Event_Observer $observer) {
$event = $observer->getEvent();
$cms_page = $event->getPage();
echo "called";
exit;
return $this;
}
}
source
share