This is one of the easiest way to show Either Error message or Success message in magento for one time.If you are thinking to show an error message or success message one time when a page load then it is the best method to use in mganeto.
Show Error Message in frontend
$message = $this->__('Email Id Already Exist.');
Mage::getSingleton('core/session')->addError($message);
Show Success message in frontend
$message = $this->__('You have Register Successfully');
Mage::getSingleton('core/session')->addSuccess($message);
If you wish show Success message or Error Message in Admin html then you need to write your code little bit different
Show Error Message in Admin page
$message = $this->__('1 row has been updated successfully');
Mage::getSingleton('adminhtml/session')->addSuccess($message);
Show Success Message in Admin page
$message = $this->__('Email Id Already Exist.');
Mage::getSingleton(adminhtml/session')->addError($message);

本文介绍了一种在Magento中显示一次性错误消息或成功消息的方法。适用于前端和后台管理页面,通过简单的代码实现不同场景下的用户反馈。
2555

被折叠的 条评论
为什么被折叠?



