/** * Return all currently registered messages from block and specified session. * * @param Mage_Core_Model_Session_Abstract $session * @return array */ protected function _getMessages(Mage_Core_Model_Session_Abstract $session) { $messages = array(); $type = 'error'; // If the message block already has been instantiated, get those messages /** @var $block Mage_Core_Block_Messages */ if ($block = Mage::app()->getLayout()->getBlock('messages')) { $messages = array_merge($messages, $block->getMessages($type)); } // Merge in the messages from the session $messages = array_merge($messages, $session->getMessages()->getItems($type)); return $messages; }