Magento newsletter subscription success message

Photo of author
Written By Ryan Rana





Right, this one is one of those truly annoying Magento-isms that have you scratching your head and trying all kinds of things.

Global success messages. Magento uses a session array that stores variables including error/success messages, they can be accessed and displayed in PHTML templates using;

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

The default page.xml file includes a call to the global messages in the default node;

<block type="core/messages" name="global_messages" as="global_messages"/>

So the latest Magento job I’m doing has a design with a newsletter signup form on the homepage. I’ve tied it into Campaign Monitor using the Fontis CM Module, everything is working great except there’s no signup message when the user submits their email, all that happens is the page reloads. That’s no use obviously, we’ll get folks repeatedly signing up unless there’s a fairly obvious success message thanking them for signing up, so I ended up scouring Stack overflow and the Magento Commerce forums looking for a fix.

The answer? Well it was a fresh install of CE and I was building the theme based on the bundled blank theme. All using the 1 Column template. The 1column.phtml template had a call to the global messages….so I thought. On closer inspection it didn’t at all, it was calling global notices, whatever they are (I don’t have time to look into it right now, this has already set me back this afternoon).

So when I changed this;

<?php echo $this->getHtml('global_notices') ?>

to this;

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

Suddenly it’s all working. It’s this kind of thing that makes working with Magento challenging shall we say.

Leave a Comment