Magento Observer Show Notice MessageReturn error message from observer MagentoShow alert in observerExclude a...

How badly should I try to prevent a user from XSSing themselves?

Alternative to sending password over mail?

Arrow those variables!

Neighboring nodes in the network

What reasons are there for a Capitalist to oppose a 100% inheritance tax?

Could gravitational lensing be used to protect a spaceship from a laser?

In Romance of the Three Kingdoms why do people still use bamboo sticks when papers are already invented?

What exploit are these user agents trying to use?

Why are electrically insulating heatsinks so rare? Is it just cost?

How can I tell someone that I want to be his or her friend?

Stopping power of mountain vs road bike

How do conventional missiles fly?

Why can't we play rap on piano?

How to draw the figure with four pentagons?

Has there ever been an airliner design involving reducing generator load by installing solar panels?

Reserved de-dupe rules

Took a trip to a parallel universe, need help deciphering

Is it inappropriate for a student to attend their mentor's dissertation defense?

90's TV series where a boy goes to another dimension through portal near power lines

What's the point of deactivating Num Lock on login screens?

What is the intuition behind short exact sequences of groups; in particular, what is the intuition behind group extensions?

Watching something be written to a file live with tail

Does casting Light, or a similar spell, have any effect when the caster is swallowed by a monster?

Is it canonical bit space?



Magento Observer Show Notice Message


Return error message from observer MagentoShow alert in observerExclude a specific categoryMagento notice message issuemagento observerUnable to set success message from helper & Observer in 1.9Magento 2: Observer Message with Yes/No Button & FunctionalitySimple Observer not firing on eventObserver conditional continue with messageSession error message from observer not showing after redirect






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I've create a custom module in Magento and I want to show notice message in admin when the observer fire so my module code like below :



etc/Config.xml



<?xml version="1.0"?>
<config>
<modules>
<MI_ProductAutoSynchronization>
<version>0.0.1</version>
</MI_ProductAutoSynchronization>
</modules>
<global>
<blocks>
<MI_ProductAutoSynchronization>
<class>MI_ProductAutoSynchronization_Block</class>
</MI_ProductAutoSynchronization>
</blocks>
<helpers>
<MI_ProductAutoSynchronization>
<class>MI_ProductAutoSynchronization_Helper</class>
</MI_ProductAutoSynchronization>
</helpers>
<models>
<MI_ProductAutoSynchronization>
<class>MI_ProductAutoSynchronization_Model</class>
</MI_ProductAutoSynchronization>
</models>
<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>
</global>
<default>
<MI_ProductAutoSynchronization>
<cron_time_update>0 0 * * *</cron_time_update>
</MI_ProductAutoSynchronization>
</default>
<crontab>
<jobs>
<MI_ProductAutoSynchronization>
<schedule>
<config_path>productautosynchronization_options/section_one/cron_time_update</config_path>
</schedule>
<run>
<model>MI_ProductAutoSynchronization/observer::test</model>
</run>
</MI_ProductAutoSynchronization>
</jobs>
</crontab>
<adminhtml>
<acl>
<resources>
<admin>
<children>
<system>
<children>
<config>
<children>
<productautosynchronization_options>
<title>Custom Configuration Section</title>
</productautosynchronization_options>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
<layout>
<updates>
<MI_ProductAutoSynchronization>
<file>mi_productautosynchronization/mi_productautosynchronization.xml</file>
</MI_ProductAutoSynchronization>
</updates>
</layout>
</adminhtml>
</config>


etc/System.xml



<?xml version="1.0"?>
<config>
<tabs>
<customconfig translate="label" module="MI_ProductAutoSynchronization">
<label>Product Auto Synch Tab</label>
<sort_order>1000002</sort_order>
</customconfig>
</tabs>

<sections>
<productautosynchronization_options translate="label" module="MI_ProductAutoSynchronization">
<label>Configuration Settings</label>
<tab>customconfig</tab>
<frontend_type>text</frontend_type>
<sort_order>1000002</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<groups>
<section_one translate="label">
<label>Product Time Update</label>
<frontend_type>text</frontend_type>
<sort_order>1</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<fields>
<cron_time_update translate="label">
<label>Products Time Update</label>
<frontend_type>select</frontend_type>
<source_model>MI_ProductAutoSynchronization/options</source_model>
<sort_order>1</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<comment>Select the time to update stock automatically.</comment>
</cron_time_update>
</fields>
</section_one>
</groups>
</productautosynchronization_options>
</sections>
</config>


Block/Adminhtml/Notification.php



<?php
class MI_ProductAutoSynchronization_Block_Adminhtml_Notifications extends Mage_Adminhtml_Block_Template
{
public function _toHtml($className = "notification-global")
{
// Let other extensions add messages
Mage::dispatchEvent('mi_productautosynchronization_notifications_before');
// Get the global notification object
$messages = Mage::getSingleton('mi_productautosynchronization/notification')->getMessages();
$html = null;
foreach ($messages as $message) {
$html .= "<div class='$className'>" . $message . "</div>";
}
return $html;
}
}


Model/ Notification.php



<?php
class MI_ProductAutoSynchronization_Model_Notification extends Varien_object
{
protected $messages = [ ];

public function getMessages()
{
return $this->messages;
}

public function setMessages($messages)
{
$this->messages = $messages;
return $this;
}

public function addMessage($message)
{
$this->messages[] = $message;
return $this;
}
}


Model/Observer.php



<?php
class MI_ProductAutoSynchronization_Model_Observer {

public function test() {
Mage::log("TEST success", null, "dev.log");
}

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;
}
}


So My Question is: How can I show notice message like screen below when test function in observer fire ?



enter image description here










share|improve this question
















bumped to the homepage by Community 12 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















    0















    I've create a custom module in Magento and I want to show notice message in admin when the observer fire so my module code like below :



    etc/Config.xml



    <?xml version="1.0"?>
    <config>
    <modules>
    <MI_ProductAutoSynchronization>
    <version>0.0.1</version>
    </MI_ProductAutoSynchronization>
    </modules>
    <global>
    <blocks>
    <MI_ProductAutoSynchronization>
    <class>MI_ProductAutoSynchronization_Block</class>
    </MI_ProductAutoSynchronization>
    </blocks>
    <helpers>
    <MI_ProductAutoSynchronization>
    <class>MI_ProductAutoSynchronization_Helper</class>
    </MI_ProductAutoSynchronization>
    </helpers>
    <models>
    <MI_ProductAutoSynchronization>
    <class>MI_ProductAutoSynchronization_Model</class>
    </MI_ProductAutoSynchronization>
    </models>
    <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>
    </global>
    <default>
    <MI_ProductAutoSynchronization>
    <cron_time_update>0 0 * * *</cron_time_update>
    </MI_ProductAutoSynchronization>
    </default>
    <crontab>
    <jobs>
    <MI_ProductAutoSynchronization>
    <schedule>
    <config_path>productautosynchronization_options/section_one/cron_time_update</config_path>
    </schedule>
    <run>
    <model>MI_ProductAutoSynchronization/observer::test</model>
    </run>
    </MI_ProductAutoSynchronization>
    </jobs>
    </crontab>
    <adminhtml>
    <acl>
    <resources>
    <admin>
    <children>
    <system>
    <children>
    <config>
    <children>
    <productautosynchronization_options>
    <title>Custom Configuration Section</title>
    </productautosynchronization_options>
    </children>
    </config>
    </children>
    </system>
    </children>
    </admin>
    </resources>
    </acl>
    <layout>
    <updates>
    <MI_ProductAutoSynchronization>
    <file>mi_productautosynchronization/mi_productautosynchronization.xml</file>
    </MI_ProductAutoSynchronization>
    </updates>
    </layout>
    </adminhtml>
    </config>


    etc/System.xml



    <?xml version="1.0"?>
    <config>
    <tabs>
    <customconfig translate="label" module="MI_ProductAutoSynchronization">
    <label>Product Auto Synch Tab</label>
    <sort_order>1000002</sort_order>
    </customconfig>
    </tabs>

    <sections>
    <productautosynchronization_options translate="label" module="MI_ProductAutoSynchronization">
    <label>Configuration Settings</label>
    <tab>customconfig</tab>
    <frontend_type>text</frontend_type>
    <sort_order>1000002</sort_order>
    <show_in_default>1</show_in_default>
    <show_in_website>1</show_in_website>
    <show_in_store>1</show_in_store>
    <groups>
    <section_one translate="label">
    <label>Product Time Update</label>
    <frontend_type>text</frontend_type>
    <sort_order>1</sort_order>
    <show_in_default>1</show_in_default>
    <show_in_website>1</show_in_website>
    <show_in_store>1</show_in_store>
    <fields>
    <cron_time_update translate="label">
    <label>Products Time Update</label>
    <frontend_type>select</frontend_type>
    <source_model>MI_ProductAutoSynchronization/options</source_model>
    <sort_order>1</sort_order>
    <show_in_default>1</show_in_default>
    <show_in_website>1</show_in_website>
    <show_in_store>1</show_in_store>
    <comment>Select the time to update stock automatically.</comment>
    </cron_time_update>
    </fields>
    </section_one>
    </groups>
    </productautosynchronization_options>
    </sections>
    </config>


    Block/Adminhtml/Notification.php



    <?php
    class MI_ProductAutoSynchronization_Block_Adminhtml_Notifications extends Mage_Adminhtml_Block_Template
    {
    public function _toHtml($className = "notification-global")
    {
    // Let other extensions add messages
    Mage::dispatchEvent('mi_productautosynchronization_notifications_before');
    // Get the global notification object
    $messages = Mage::getSingleton('mi_productautosynchronization/notification')->getMessages();
    $html = null;
    foreach ($messages as $message) {
    $html .= "<div class='$className'>" . $message . "</div>";
    }
    return $html;
    }
    }


    Model/ Notification.php



    <?php
    class MI_ProductAutoSynchronization_Model_Notification extends Varien_object
    {
    protected $messages = [ ];

    public function getMessages()
    {
    return $this->messages;
    }

    public function setMessages($messages)
    {
    $this->messages = $messages;
    return $this;
    }

    public function addMessage($message)
    {
    $this->messages[] = $message;
    return $this;
    }
    }


    Model/Observer.php



    <?php
    class MI_ProductAutoSynchronization_Model_Observer {

    public function test() {
    Mage::log("TEST success", null, "dev.log");
    }

    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;
    }
    }


    So My Question is: How can I show notice message like screen below when test function in observer fire ?



    enter image description here










    share|improve this question
















    bumped to the homepage by Community 12 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      0












      0








      0








      I've create a custom module in Magento and I want to show notice message in admin when the observer fire so my module code like below :



      etc/Config.xml



      <?xml version="1.0"?>
      <config>
      <modules>
      <MI_ProductAutoSynchronization>
      <version>0.0.1</version>
      </MI_ProductAutoSynchronization>
      </modules>
      <global>
      <blocks>
      <MI_ProductAutoSynchronization>
      <class>MI_ProductAutoSynchronization_Block</class>
      </MI_ProductAutoSynchronization>
      </blocks>
      <helpers>
      <MI_ProductAutoSynchronization>
      <class>MI_ProductAutoSynchronization_Helper</class>
      </MI_ProductAutoSynchronization>
      </helpers>
      <models>
      <MI_ProductAutoSynchronization>
      <class>MI_ProductAutoSynchronization_Model</class>
      </MI_ProductAutoSynchronization>
      </models>
      <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>
      </global>
      <default>
      <MI_ProductAutoSynchronization>
      <cron_time_update>0 0 * * *</cron_time_update>
      </MI_ProductAutoSynchronization>
      </default>
      <crontab>
      <jobs>
      <MI_ProductAutoSynchronization>
      <schedule>
      <config_path>productautosynchronization_options/section_one/cron_time_update</config_path>
      </schedule>
      <run>
      <model>MI_ProductAutoSynchronization/observer::test</model>
      </run>
      </MI_ProductAutoSynchronization>
      </jobs>
      </crontab>
      <adminhtml>
      <acl>
      <resources>
      <admin>
      <children>
      <system>
      <children>
      <config>
      <children>
      <productautosynchronization_options>
      <title>Custom Configuration Section</title>
      </productautosynchronization_options>
      </children>
      </config>
      </children>
      </system>
      </children>
      </admin>
      </resources>
      </acl>
      <layout>
      <updates>
      <MI_ProductAutoSynchronization>
      <file>mi_productautosynchronization/mi_productautosynchronization.xml</file>
      </MI_ProductAutoSynchronization>
      </updates>
      </layout>
      </adminhtml>
      </config>


      etc/System.xml



      <?xml version="1.0"?>
      <config>
      <tabs>
      <customconfig translate="label" module="MI_ProductAutoSynchronization">
      <label>Product Auto Synch Tab</label>
      <sort_order>1000002</sort_order>
      </customconfig>
      </tabs>

      <sections>
      <productautosynchronization_options translate="label" module="MI_ProductAutoSynchronization">
      <label>Configuration Settings</label>
      <tab>customconfig</tab>
      <frontend_type>text</frontend_type>
      <sort_order>1000002</sort_order>
      <show_in_default>1</show_in_default>
      <show_in_website>1</show_in_website>
      <show_in_store>1</show_in_store>
      <groups>
      <section_one translate="label">
      <label>Product Time Update</label>
      <frontend_type>text</frontend_type>
      <sort_order>1</sort_order>
      <show_in_default>1</show_in_default>
      <show_in_website>1</show_in_website>
      <show_in_store>1</show_in_store>
      <fields>
      <cron_time_update translate="label">
      <label>Products Time Update</label>
      <frontend_type>select</frontend_type>
      <source_model>MI_ProductAutoSynchronization/options</source_model>
      <sort_order>1</sort_order>
      <show_in_default>1</show_in_default>
      <show_in_website>1</show_in_website>
      <show_in_store>1</show_in_store>
      <comment>Select the time to update stock automatically.</comment>
      </cron_time_update>
      </fields>
      </section_one>
      </groups>
      </productautosynchronization_options>
      </sections>
      </config>


      Block/Adminhtml/Notification.php



      <?php
      class MI_ProductAutoSynchronization_Block_Adminhtml_Notifications extends Mage_Adminhtml_Block_Template
      {
      public function _toHtml($className = "notification-global")
      {
      // Let other extensions add messages
      Mage::dispatchEvent('mi_productautosynchronization_notifications_before');
      // Get the global notification object
      $messages = Mage::getSingleton('mi_productautosynchronization/notification')->getMessages();
      $html = null;
      foreach ($messages as $message) {
      $html .= "<div class='$className'>" . $message . "</div>";
      }
      return $html;
      }
      }


      Model/ Notification.php



      <?php
      class MI_ProductAutoSynchronization_Model_Notification extends Varien_object
      {
      protected $messages = [ ];

      public function getMessages()
      {
      return $this->messages;
      }

      public function setMessages($messages)
      {
      $this->messages = $messages;
      return $this;
      }

      public function addMessage($message)
      {
      $this->messages[] = $message;
      return $this;
      }
      }


      Model/Observer.php



      <?php
      class MI_ProductAutoSynchronization_Model_Observer {

      public function test() {
      Mage::log("TEST success", null, "dev.log");
      }

      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;
      }
      }


      So My Question is: How can I show notice message like screen below when test function in observer fire ?



      enter image description here










      share|improve this question
















      I've create a custom module in Magento and I want to show notice message in admin when the observer fire so my module code like below :



      etc/Config.xml



      <?xml version="1.0"?>
      <config>
      <modules>
      <MI_ProductAutoSynchronization>
      <version>0.0.1</version>
      </MI_ProductAutoSynchronization>
      </modules>
      <global>
      <blocks>
      <MI_ProductAutoSynchronization>
      <class>MI_ProductAutoSynchronization_Block</class>
      </MI_ProductAutoSynchronization>
      </blocks>
      <helpers>
      <MI_ProductAutoSynchronization>
      <class>MI_ProductAutoSynchronization_Helper</class>
      </MI_ProductAutoSynchronization>
      </helpers>
      <models>
      <MI_ProductAutoSynchronization>
      <class>MI_ProductAutoSynchronization_Model</class>
      </MI_ProductAutoSynchronization>
      </models>
      <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>
      </global>
      <default>
      <MI_ProductAutoSynchronization>
      <cron_time_update>0 0 * * *</cron_time_update>
      </MI_ProductAutoSynchronization>
      </default>
      <crontab>
      <jobs>
      <MI_ProductAutoSynchronization>
      <schedule>
      <config_path>productautosynchronization_options/section_one/cron_time_update</config_path>
      </schedule>
      <run>
      <model>MI_ProductAutoSynchronization/observer::test</model>
      </run>
      </MI_ProductAutoSynchronization>
      </jobs>
      </crontab>
      <adminhtml>
      <acl>
      <resources>
      <admin>
      <children>
      <system>
      <children>
      <config>
      <children>
      <productautosynchronization_options>
      <title>Custom Configuration Section</title>
      </productautosynchronization_options>
      </children>
      </config>
      </children>
      </system>
      </children>
      </admin>
      </resources>
      </acl>
      <layout>
      <updates>
      <MI_ProductAutoSynchronization>
      <file>mi_productautosynchronization/mi_productautosynchronization.xml</file>
      </MI_ProductAutoSynchronization>
      </updates>
      </layout>
      </adminhtml>
      </config>


      etc/System.xml



      <?xml version="1.0"?>
      <config>
      <tabs>
      <customconfig translate="label" module="MI_ProductAutoSynchronization">
      <label>Product Auto Synch Tab</label>
      <sort_order>1000002</sort_order>
      </customconfig>
      </tabs>

      <sections>
      <productautosynchronization_options translate="label" module="MI_ProductAutoSynchronization">
      <label>Configuration Settings</label>
      <tab>customconfig</tab>
      <frontend_type>text</frontend_type>
      <sort_order>1000002</sort_order>
      <show_in_default>1</show_in_default>
      <show_in_website>1</show_in_website>
      <show_in_store>1</show_in_store>
      <groups>
      <section_one translate="label">
      <label>Product Time Update</label>
      <frontend_type>text</frontend_type>
      <sort_order>1</sort_order>
      <show_in_default>1</show_in_default>
      <show_in_website>1</show_in_website>
      <show_in_store>1</show_in_store>
      <fields>
      <cron_time_update translate="label">
      <label>Products Time Update</label>
      <frontend_type>select</frontend_type>
      <source_model>MI_ProductAutoSynchronization/options</source_model>
      <sort_order>1</sort_order>
      <show_in_default>1</show_in_default>
      <show_in_website>1</show_in_website>
      <show_in_store>1</show_in_store>
      <comment>Select the time to update stock automatically.</comment>
      </cron_time_update>
      </fields>
      </section_one>
      </groups>
      </productautosynchronization_options>
      </sections>
      </config>


      Block/Adminhtml/Notification.php



      <?php
      class MI_ProductAutoSynchronization_Block_Adminhtml_Notifications extends Mage_Adminhtml_Block_Template
      {
      public function _toHtml($className = "notification-global")
      {
      // Let other extensions add messages
      Mage::dispatchEvent('mi_productautosynchronization_notifications_before');
      // Get the global notification object
      $messages = Mage::getSingleton('mi_productautosynchronization/notification')->getMessages();
      $html = null;
      foreach ($messages as $message) {
      $html .= "<div class='$className'>" . $message . "</div>";
      }
      return $html;
      }
      }


      Model/ Notification.php



      <?php
      class MI_ProductAutoSynchronization_Model_Notification extends Varien_object
      {
      protected $messages = [ ];

      public function getMessages()
      {
      return $this->messages;
      }

      public function setMessages($messages)
      {
      $this->messages = $messages;
      return $this;
      }

      public function addMessage($message)
      {
      $this->messages[] = $message;
      return $this;
      }
      }


      Model/Observer.php



      <?php
      class MI_ProductAutoSynchronization_Model_Observer {

      public function test() {
      Mage::log("TEST success", null, "dev.log");
      }

      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;
      }
      }


      So My Question is: How can I show notice message like screen below when test function in observer fire ?



      enter image description here







      magento-1.9 event-observer adminnotification






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 14 '17 at 8:32







      mahmoudismail

















      asked Jul 14 '17 at 8:07









      mahmoudismailmahmoudismail

      4191426




      4191426





      bumped to the homepage by Community 12 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 12 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          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;
          }
          }


          How the session messages work ?




          addSuccess, addError, addNotice, addWarning.



          The message that you give for those methods are stored in the session.
          when a page is viewed, Magento checks in the session for messages. If
          there are any, they are displayed and removed from the session, all the messages are saved to the session and are shown the next time.







          share|improve this answer


























          • Sorry i've update my screenshot in my question i want this notice message in admin not in frontend.

            – mahmoudismail
            Jul 14 '17 at 8:33











          • please look my update

            – PЯINCƏ
            Jul 14 '17 at 8:42











          • i've got this error Fatal error: Call to a member function getEvent() on null in /MI/ProductAutoSynchronization/Model/Observer.php on line 8

            – mahmoudismail
            Jul 14 '17 at 8:44











          • look again now.

            – PЯINCƏ
            Jul 14 '17 at 9:04











          • Sorry but it's not working.

            – mahmoudismail
            Jul 14 '17 at 9:31












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "479"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f183722%2fmagento-observer-show-notice-message%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          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;
          }
          }


          How the session messages work ?




          addSuccess, addError, addNotice, addWarning.



          The message that you give for those methods are stored in the session.
          when a page is viewed, Magento checks in the session for messages. If
          there are any, they are displayed and removed from the session, all the messages are saved to the session and are shown the next time.







          share|improve this answer


























          • Sorry i've update my screenshot in my question i want this notice message in admin not in frontend.

            – mahmoudismail
            Jul 14 '17 at 8:33











          • please look my update

            – PЯINCƏ
            Jul 14 '17 at 8:42











          • i've got this error Fatal error: Call to a member function getEvent() on null in /MI/ProductAutoSynchronization/Model/Observer.php on line 8

            – mahmoudismail
            Jul 14 '17 at 8:44











          • look again now.

            – PЯINCƏ
            Jul 14 '17 at 9:04











          • Sorry but it's not working.

            – mahmoudismail
            Jul 14 '17 at 9:31
















          0














          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;
          }
          }


          How the session messages work ?




          addSuccess, addError, addNotice, addWarning.



          The message that you give for those methods are stored in the session.
          when a page is viewed, Magento checks in the session for messages. If
          there are any, they are displayed and removed from the session, all the messages are saved to the session and are shown the next time.







          share|improve this answer


























          • Sorry i've update my screenshot in my question i want this notice message in admin not in frontend.

            – mahmoudismail
            Jul 14 '17 at 8:33











          • please look my update

            – PЯINCƏ
            Jul 14 '17 at 8:42











          • i've got this error Fatal error: Call to a member function getEvent() on null in /MI/ProductAutoSynchronization/Model/Observer.php on line 8

            – mahmoudismail
            Jul 14 '17 at 8:44











          • look again now.

            – PЯINCƏ
            Jul 14 '17 at 9:04











          • Sorry but it's not working.

            – mahmoudismail
            Jul 14 '17 at 9:31














          0












          0








          0







          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;
          }
          }


          How the session messages work ?




          addSuccess, addError, addNotice, addWarning.



          The message that you give for those methods are stored in the session.
          when a page is viewed, Magento checks in the session for messages. If
          there are any, they are displayed and removed from the session, all the messages are saved to the session and are shown the next time.







          share|improve this answer















          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;
          }
          }


          How the session messages work ?




          addSuccess, addError, addNotice, addWarning.



          The message that you give for those methods are stored in the session.
          when a page is viewed, Magento checks in the session for messages. If
          there are any, they are displayed and removed from the session, all the messages are saved to the session and are shown the next time.








          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jul 14 '17 at 14:59

























          answered Jul 14 '17 at 8:26









          PЯINCƏPЯINCƏ

          8,41431145




          8,41431145













          • Sorry i've update my screenshot in my question i want this notice message in admin not in frontend.

            – mahmoudismail
            Jul 14 '17 at 8:33











          • please look my update

            – PЯINCƏ
            Jul 14 '17 at 8:42











          • i've got this error Fatal error: Call to a member function getEvent() on null in /MI/ProductAutoSynchronization/Model/Observer.php on line 8

            – mahmoudismail
            Jul 14 '17 at 8:44











          • look again now.

            – PЯINCƏ
            Jul 14 '17 at 9:04











          • Sorry but it's not working.

            – mahmoudismail
            Jul 14 '17 at 9:31



















          • Sorry i've update my screenshot in my question i want this notice message in admin not in frontend.

            – mahmoudismail
            Jul 14 '17 at 8:33











          • please look my update

            – PЯINCƏ
            Jul 14 '17 at 8:42











          • i've got this error Fatal error: Call to a member function getEvent() on null in /MI/ProductAutoSynchronization/Model/Observer.php on line 8

            – mahmoudismail
            Jul 14 '17 at 8:44











          • look again now.

            – PЯINCƏ
            Jul 14 '17 at 9:04











          • Sorry but it's not working.

            – mahmoudismail
            Jul 14 '17 at 9:31

















          Sorry i've update my screenshot in my question i want this notice message in admin not in frontend.

          – mahmoudismail
          Jul 14 '17 at 8:33





          Sorry i've update my screenshot in my question i want this notice message in admin not in frontend.

          – mahmoudismail
          Jul 14 '17 at 8:33













          please look my update

          – PЯINCƏ
          Jul 14 '17 at 8:42





          please look my update

          – PЯINCƏ
          Jul 14 '17 at 8:42













          i've got this error Fatal error: Call to a member function getEvent() on null in /MI/ProductAutoSynchronization/Model/Observer.php on line 8

          – mahmoudismail
          Jul 14 '17 at 8:44





          i've got this error Fatal error: Call to a member function getEvent() on null in /MI/ProductAutoSynchronization/Model/Observer.php on line 8

          – mahmoudismail
          Jul 14 '17 at 8:44













          look again now.

          – PЯINCƏ
          Jul 14 '17 at 9:04





          look again now.

          – PЯINCƏ
          Jul 14 '17 at 9:04













          Sorry but it's not working.

          – mahmoudismail
          Jul 14 '17 at 9:31





          Sorry but it's not working.

          – mahmoudismail
          Jul 14 '17 at 9:31


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f183722%2fmagento-observer-show-notice-message%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

          How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

          夢乃愛華...