I am using magento 1.8. I have custom theme. I am unable to get newsletter error/success messages when customer submit their email-id for subscription.

I have done many changes to get and print messages. But it won't work.

I am getting messages by below code

$messages = Mage::getSingleton('core/session')->getMessages(true);
    echo "<pre>"; var_dump($messages);

object(Mage_Core_Model_Message_Collection)#281 (2) {
  array(0) {
  object(Mage_Core_Model_Message_Error)#120 (6) {
    string(5) "error"
    string(102) "Il y a eu un problème lors de l'inscription : This email address is already assigned to another user."
    string(0) ""
    string(0) ""

But I am unable to print it. I have tried below code.

   foreach($messages->getItems() as $message) {
        echo $message->getText();

Even I am not getting any thing in forloop. Help me,, Thanks in advance:)


You can print the messages in a template like this:

<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>

But there is a catch.
For example the newsletter subscription message is added to Mage::getSingleton('core/session').
So in order to see te core/session messages you need to add this in the controller that renders the template:


after calling

  • 1
    Wow, good to know, thanks! I always thought it is a core bug, that only core/session is rendered! :D – Fabian Blechschmidt Aug 21 '14 at 8:33

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.