Ask your Question



Be healthy and stay in shape

Mohali,  India
Everest Links
Everest Links

Everest Links Management Consultants

Dubai,  United Arab Emirates

Business Owner

Gurugram,  India

Web Developer

Chennai,  India


Hayward,  United States

Write to us

Ask Question

Magento Events and Observers

 To separate your custom code from the core code we use event driven programming where an event is fired and an observer is listening for specific events and executing certain logics on specific event. These events have certain class objects attached as function parameter .Observers (Class functions) runs when the event is fired and receive the class objects. The observer manipulates and receives data from class objects (event) and performs the operation on data according to requirement.

To create some observer on a specific event we need to create our own module and

event in config.xml of the module as below.

We will define the event under events tags in config.xml and under observer tag we need to define the name of the method call after event fire

Suppose we need send an custom email after every successful order, then we


Need to call the observer on checkout_onepage_controller_sucess_action and we have to define it in config.xml file of our module.

File: app/code/local/Letsknowit/Checkout/etc/config.xml <global>
      <checkout_onepage_controller_success_action>   //Event Name
          <sendcustomemail>   //Name of observer



Now in our custom module we need to define our observer function in Observer.php


File: app/code/local/Letsknowit/Checkout/Model/Observer.php class Letsknowit_Postdata_Model_Checkout_Observer


public function sendcustomemail(Varien_Event_Observer $observer){




After every successful order the observer function call and will do the required functionality


0   0
Aditya Singh

Please rotate your device

We don't support landscape mode on your device. Please rotate to portrait mode for the best view of our site