What is Observer’s in Magento

Magento, implement an event/observer pattern like any good Object Oriented System for the end user. In Magento Some of the  action happen during any page request ( any model serve, any user logs in etc..) , for such magento issued an event signal. So when you create your own module, you can listen for the same events.

So lets clear it with example:

let’s assume that you wanted to get an email notification every time when any user logged into your store, in that case you could listen for the “user_login” event in the config.xml


             <type> Singleton </type>
             <class> myModule/Observer </class>
             <method>loginNotification </method>

and then write below code inside “app/code/vendorName/myModule/Model/Observer.php”


class Gs_Searchtap_Model_Observer extends Varien_Event_Observer

public function loginNotification($observer)


$data= $observer->getData();

// Now your stuff here to check user data;



Happy Coding 🙂


Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *