Question

Not looking to display form validation errors, but more global messages like "Hurry quick -- offer ends in 4 hours" or "Currently there are 3 users online".

The question is not about how to generate the messages, but how to best present them in a way that will work nicely in any (or at least most) themes.

Was it helpful?

Solution

You can use the Magento notification system. It should work anywhere anytime.

Notice

Mage::getSingleton(‘core/session’)->addNotice(‘Notice message’);

Success

Mage::getSingleton(‘core/session’)->addSuccess(‘Success message’); 

Error

Mage::getSingleton(‘core/session’)->addError(‘Error message’); 

Mage::getSingleton(‘adminhtml/session’)->addWarning(‘Warning message’); 

(Admin only)

If this is not what you are looking for but the block in charge of displaying these messages, you need the message block.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top