I learned a valuable lesson this weekend (the hard way of course) when it comes to event observers in Magento. You’ve got 3 different places to setup your event observers in your config.xml file of your modules. They are as follows:
<config> <frontend> <events> ... </events> <frontend> <adminhtml> <events> ... </events> <adminhtml> <global> <events> ... </events> <global> </config>
It is pretty self-explanatory, but here’s how it works: Events are firing off all the time. If you are needing to observe an event, but only when it happens on the frontend, then you would put your observer in the ‘frontend’ section. That same event might also be fired off in the admin, but your module won’t observe that event from the admin if you have it in ‘frontend’. If you want the event to be observed no matter where it happens (admin or frontend), you would then put your observer in the ‘global’ section.
I was trying to observe an event that should be fired off when an order is edited in the admin. I wasn’t able to log anything in my observer at all, and I couldn’t figure out why. Turns out it was because I had the event observer in the ‘frontend’ section. I changed it to ‘adminhtml’ and then it worked just fine.