1

I simply wonder how to interact with the global_messages block.

I'm aware of http://inchoo.net/magento/magento-frontend/utilizing-magento-notification-system/ and https://makandracards.com/magento/10723-messages-and-global-messages-blocks

When I add a message, for example :

Mage::getSingleton('customer/session')->addError('Please enter all required information');

It is rendered with <?php echo $this->getMessagesBlock()->getGroupedHtml() ?> in the template.

But as getMessagesBlock() always retrieves or creates the block aliased messages I can't understand how to populate global_messages block.

I understand "Global Messages" should be displayed with

 <?php echo $this->getChildHtml('global_messages') ?>

but how to set a message in this global_messages block ?

  • Its not very clear what your trying to achieve, using the addError should populate the message in that block (with an error message) there is also other states as described in the Inchoo article you have linked to. Are you trying to customise the output of the block with static html beyond that of the messages? – John Cuthbert May 17 '16 at 14:15
  • I'm considering to remove echo $this->getChildHtml('global_messages') calls in order to decrease ESI calls with turpentine / varnish module. Before that, I want to be sure not to remove important things for customer. As, I don't see how global_messages can be populated, I ask. On the website I'm working on, I achieve to populate the "messages" block, but not the "global_messages" one – azurams May 17 '16 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.