Saturday, February 23, 2013

Magento: Get the list of events from magento


Use following code in action of magento
$eventAreas = array('global','frontend','adminhtml');
foreach ($eventAreas as $eventArea) {
    $eventConfig = Mage::app()->getConfig()
                       ->getNode(sprintf('%s/events', $eventArea));
    foreach($eventConfig->children() as $key=>$value)
    {
        foreach($value->observers->children() as $key1=>$value1)
        {
            $observer_method = array((string)$eventArea,
            (string)$key,
            (string)$key1,
            (string)Mage::app()->getConfig()
                        ->getModelClassName($value1->class),
            (string)$value1->method);
             echo '<pre>';
             print_r($observer_method);
             echo '</pre>';
        }
    }
}

No comments:

Post a Comment