I am working on site where i have to listen for the matching events and run code according to that event.when print the code in observer

print_r($observer->getEvent()->getControllerAction()->getFullActionName());. I got the events name like ( customer_account_loginPost,customer_account_login,catalog_category_view,checkout_cart_add). But when i check the event list (on different webistes like magentocommerce,nickysys ) for the events name they are different like(customer_login,add_to_cart_before etc) and also my captured events name are not there

. How can i map these events with each other.I am confuse about the events names.


You are not outputting the event names with print_r($observer->getEvent()->getControllerAction()->getFullActionName());

You are outputting the ACTION NAMES, in controllers, that the event is from.

for example: customer_account_loginPost is module customer, controller account, and method loginPost in that controller.

To get the list of events that get run during a page load, edit app/mage.php and in the method dispatchEvent echo out the $name variable.

  • But i want to get event name in observer.How can do that ? – Mahmood Rehman Oct 8 '13 at 6:53
  • Why would you need to do that? You are already in the event, thus why would you need the name of the event? The only reason I can phantom you are needing this is that you are using the same method for all your events? Anyways - the event name can be found using the call $observer->getEvent()->getName() – ProxiBlue Oct 8 '13 at 7:52
  • GetName shows current event name.I want to listen for the events in my observer .Like if someone click on add to cart then i got add_to_cat event.I want to do it in my observer.Hopes you got my point. – Mahmood Rehman Oct 8 '13 at 10:38
  • 1
    Ok, You are misunderstanding how the events work / what they are. Please read this: solvingmagento.com/events-and-observers-a-magento-tutorial – ProxiBlue Oct 8 '13 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.