Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

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/

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