eventsmagentocoding-styleexploratory

How to find an appropriate event in Magento?


Sometimes when looking for a convenient event to hook I do a bit of exploratory programming...

This gives me a screen full of boring data and the names of objects being passed. Other than the START and STOP I'm usually not looking for anything specific enough to grep for it and I have to rely on my experience to identify possible bootstrap points. For example when placing orders I know there is often a 'quote' somewhere, or it is possible to get a reference to the order through a 'payment' object, or vice-versa.

Then I have to remember to remove my markers (not that hard when using any sort of versioning).

What methods do you use to find events? Can you do it without modifying core code?


Solution

  • As of 1.2 the event list was curated on the Magento Wiki. You can find that list here:

    http://www.magentocommerce.com/wiki/_media/magento_events_v1.2.0.2.xls

    However, since then various events have been deprecated. There is a list here but it's only current as of 1.4

    http://masteringmagento.com/2010/06/events-list-in-magento-community-1-4/

    If you're handy, you can execute grep -R dispatchEvent in your Magento working directory and parse through the dearth of dispatch calls. These are the actual definitons of all Magento events in your particular version.

    Edit 2/14/2013:

    This list, being a couple of years old, is no longer valid. I suggest that you use the following resource as it is not only a better answer but gives you many examples and sources of finding better event hooks.

    https://magento.stackexchange.com/a/167/336