Magento Watcher not working

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) {   // current layout

         $event = $observer->getEvent();
         $cms_page = $event->getPage();  
         echo "called";
         exit;
         return $this;

    }
}
+4
source share
1 answer

There are a lot of problems in the modules.

As an observer die() may be not works.Use Magentolog print to check the observer work or not

. upper letter mycustom to Mycustom. .

:

config.xml:

<?xml version="1.0"?>
<config>
  <modules>
    <Mycustom_GeoLocation>
      <version>0.1.0</version>
    </Mycustom_GeoLocation>
  </modules>
  <global>
    <models>
      <geolocation>
        <class>Mycustom_GeoLocation_Model</class>
      </geolocation>
    </models>
    <events>
      <cms_page_render> 
        <observers>
          <cms_page_render_handler> 
            <type>model</type> 
            <class>geolocation/observer</class> <!-- observers class alias -->
            <method>getGeoLocation</method>  
           </cms_page_render_handler>
        </observers>
      </cms_page_render>
    </events>
  </global>
</config> 

github

+1

All Articles