Try the Demo

Magento Forum

   
How to display ERROR
 
gamelodge
Sr. Member
 
Avatar
Total Posts:  89
Joined:  2007-08-31
Brisbane, Qld, Australia
 

Please help I have cant get this to work.

I have a template file:

suburbs.phtml

<h1>Do we deliver to your suburb</h1>
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>

I have a controller

class Grocer_Suburbs_IndexController extends Mage_Core_Controller_Front_Action
{
    
public function indexAction()
    
{
        $session 
$this->_getSession();
        
$this->_initLayoutMessages('core/session');
        
        
$session->addError($this->__('Well Done'));
        
        
$this->loadLayout();
        
$this->renderLayout();
    
}
    
    
protected function _getSession()
    
{
        
return Mage::getSingleton('core/session');
    
}

It shows the heading ‘Do we deliver to your suburb’ but no error, Why will it not show the error.
if i print_r($session) session there error is there

see here: (part of print_r())

Mage_Core_Model_Message_Collection Object [_messages:protected] => Array ( [error] => Array ( [0] => 
Mage_Core_Model_Message_Error Object [_type:protected] => error [_code:protected] => Well Done

 
Magento Community Magento Community
Magento Community
Magento Community
 
gamelodge
Sr. Member
 
Avatar
Total Posts:  89
Joined:  2007-08-31
Brisbane, Qld, Australia
 

help ? :(

 
Magento Community Magento Community
Magento Community
Magento Community
 
Anton Makarenko
Magento Team
 
Avatar
Total Posts:  184
Joined:  2008-05-13
Los Angeles, CA
 

Duplicate of http://www.magentocommerce.com/boards/viewthread/11267/

 Signature 

Magento Tech PM
--
To avoid trouble, don’t tamper with core code. Write customizations!
Community-driven User Guide
Feel free to send me PM with links to really interesting or problematic forum posts.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top