Sometimes when you’re tracking down a bit of tricky Magento functionality, you need to quickly suss out not only what events have fired, but which observer methods are actually listening for the events that fired on a particular request.
There’s no elegant way to doing this with Magento, but if you’re not above a little temporary logging code in core files (moved to the local
code pool, of course), then a few extra lines at the start of _callObserverMethod
is what you want.
#File: app/code/core/Mage/Core/Model/App.php
protected function _callObserverMethod($object, $method, $observer)
{
$log = 'Trying to call ' . $method . ' on ' . get_class($object)
. ' for ' . $observer->getEvent()->getName();
file_put_contents('/tmp/test.log',"$log n",FILE_APPEND);
Mage::Log($log);
if (method_exists($object, $method)) {
$object->$method($observer);
} elseif (Mage::getIsDeveloperMode()) {
Mage::throwException('Method "'.$method.'" is not defined in "'.get_class($object).'"');
}
return $this;
}