config.xml update this :
<events>
<mi_productautosynchronization_notifications_before>
<observers>
<mi_productautosynchronization_observer>
<type>singleton</type>
<class>MI_ProductAutoSynchronization_Model_Observer</class>
<method>checkMessages</method>
</mi_productautosynchronization_observer>
</observers>
</mi_productautosynchronization_notifications_before>
</events>
to :
<events>
<mi_productautosynchronization_notifications_before>
<observers>
<mi_productautosynchronization_observer>
<type>singleton</type>
<class>MI_ProductAutoSynchronization_Model_Observer</class>
<method>checkMessages</method>
</mi_productautosynchronization_observer>
<mi_productautosynchronization_test_observer>
<type>singleton</type>
<class>MI_ProductAutoSynchronization_Model_Observer</class>
<method>test</method>
</mi_productautosynchronization_test_observer>
</observers>
</mi_productautosynchronization_notifications_before>
</events>
Observer.php
<?php
class MI_ProductAutoSynchronization_Model_Observer extends Varien_Event_Observer {
public function test($observer) {
/*Display the message in the next refresh*/
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('MI_ProductAutoSynchronization')->__('Error sending Email'));
// Refresh and display
// $controllerAction = $observer->getEvent()->getControllerAction();
// Mage::log("TEST success", null, "dev.log"); // for your logs
// Mage::getSingleton('adminhtml/session')->addError(Mage::helper('MI_ProductAutoSynchronization')->__('Error sending Email'));
// Mage::app()->getResponse()->setRedirect($controllerAction->getUrl('*/sales_order/')); //the controller where you want to redirect
// Mage::app()->getResponse()->sendResponse();
// exit ;
}
public function checkMessages($observer) {
Mage::log("notification success", null, "dev.log");
$notifications = Mage::getSingleton('mi_productautosynchronization/notification');
$notifications->addMessage("I was sent by mi_productautosynchronization");
return $observer;
}
}