如何在magento中添加自定义错误消息

Jon*_*och 3 magento

track your order在页脚中添加了一个链接.如果用户未登录就单击此链接,则应显示错误消息please login to track your order.

我是magento的新手,请指导我这样做.

Mar*_*kie 10

已添加,因为此问题出现在Google中.

对于黄色"警告"消息(您可能想要用于此目的的消息),请使用

Mage::getSingleton('core/session')->addNotice('Please log in to track your order');
Run Code Online (Sandbox Code Playgroud)

要获得绿色"成功"消息,请使用

Mage::getSingleton('core/session')->addSuccess('Tracking successful');
Run Code Online (Sandbox Code Playgroud)

对于红色"错误"消息,请使用

Mage::getSingleton('core/session')->addError('There was an error tracking your parcel');
Run Code Online (Sandbox Code Playgroud)