It turns out after hours of searching and trial and error that this task is relatively simple.
In your controller you simply do this:
$session = Mage::getSingleton('core/session');
$session->addError($this->__('My error Message'));
in your template file you then call the message like this:
<?php echo $this->getMessagesBlock()->getGroupedHtml(); ?>
I recommend creating some helper methods you can call in your controller:
private function add_error($error)
{
$session = Mage::getSingleton('core/session');
$session->addError($this->__($error));
}
private function clear_errors()
{
$session = Mage::getSingleton('core/session');
$session->getMessages(true);
}
Leave a Reply