Social Icons

twitterfacebookgoogle pluslinkedinemail

Sunday, 29 September 2013

How to set Error and success message in magento

Hello  Friends,

You can set error and success message in magento through the following code

Mage::getSingleton('core/session')->addSuccess(Mage::helper('module_name')->__('Please Type Your Success Message'));

Mage::getSingleton('core/session')->addError(Mage::helper('module_name')->__('Please Type Your Error Message'));

Now Code for display error and success message on phtml

<div id="message">
   <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>

I hope this post helpful to all my needed friends...


  1. Hi,
    This code "$this->getMessagesBlock()->getGroupedHtml()" is not showing error or success message using custom module. please share another code to get error or success message..


    1. did you set it in session because without set in session it will not display

  2. Thanks for the best was very useful for me.keep sharing such ideas in the future as well.this was actually what i was looking for,and i am glad to came here!
    magento development company in bangalore 



Free Advertisement

Free Advertisement

Free Advertisement

Free Advertisement