If you're running any backend processing for Magento (unit tests, automated billing cycles, etc.) that rely on the Mage::dispatchEvent() mechanism, be careful of scope in your config.xml!
If your <events>
block is inside <frontend>
, then those events will trigger only when triggered by a frontend action (ie, someone interacts with your site using a browser.)
If you want your events to be triggered by backend processes as well, put them directly under your <global>
block in config.xml instead (note: they will trigger from the frontend as well)
You can debug missed events by peeking into Mage_Core_Model_App::dispatchEvent and adding debug, such as this (version 1.4.1.1):
public function dispatchEvent($eventName, $args)
{
foreach ($this->_events as $area=>$events) {
if (!isset($events[$eventName])) {
$eventConfig = $this->getConfig()->getEventConfig($area, $eventName);
if (!$eventConfig) {
if ( preg_match('/MY_EVENT_ONE|MY_EVENT_TWO/', $eventName) )
Mage::log("MISSED EVENT: '$area' '$eventName' ".print_r($this->_events[$area],true));
$this->_events[$area][$eventName] = false;
continue;
}
...
Comments