Magento add custom error messages
Magento add custom error messages : Displaying messages in proper format is very important in any application. Magento provides you the method to add the custom error messages in session which will be displayed on the page. Here we are going to explain the method to add the error messages in the session.
Magento add custom error messages
Here are the following inbuilt functions to add & display messages.
- Success
- Error
- Warning
- Notice
Let us go one by one –
Magento add success message
You can add the success message as below –
Magento add success message :
Mage::getSingleton('core/session')->addSuccess('Add success message.'); |
Add you success message in the session as above and this message will be automatically displayed and flushed.
Magento add error message
You can add the error message as below –
Magento add error message :
Mage::getSingleton('core/session')->addError('Add error message.'); |
Add you error message in the session as above and this message will be automatically displayed and flushed.
Magento add warning message
You can add and display the warning message as below –
Magento add error message :
Mage::getSingleton('core/session')->addWarning('Add warning message.'); |
Add you warning message in the session as above and this message will be automatically displayed and flushed.
Magento add notice message
You can add and display the notice message as below –
Magento add notice message :
Mage::getSingleton('core/session')->addNotice('Add notice message.'); |
Add you notice message in the session as above and this message will be automatically displayed and flushed.
Advertisements