Adding a Notification Bar to Magento February 20 2012

One of the first modifications I wanted to make to my first installation of Magento was to create a simple notification bar across the top of the site for displaying announcements and notices to visitors and customers. My initial solution was to simply make use of the built-in Magento Demo Store notice, which I will describe next.
Magento Notices Template
A quick and easy way to display a notification bar is to piggy-back off of the existing Magento notices template. Browsing through the Magento admin: System > Configuration > General – Design > HTML Head, we find the ‘Display Demo Store Notice’ option. Enabling this adds a demo store notice across the top of all pages like so:

This demo store notice is added by the notices.phtml template, found at: app/design/frontend/base/default/template/page/html/notices.phtml. This template file can be copied into your own theme, and then edited directly to add a line like the following to the bottom of the file:
Hello World!
Make sure the demo store notice configuration mentioned above is disabled so you don’t get a double bar displayed. Style the bar to match your site theme, and you’ve got a serviceable, if limited notification bar.
Notification Bar Extension
Recently I found some time to revisit my notification bar implementation, and decided to address some of the drawbacks:
- Turning it on or off requires editing the template file
- Changing the message requires editing the template file
- You can’t use those fancy template tags, ie
{{config path="general/store_information/phone"}}, for doing things like displaying the configured store telephone number
With those shortcomings in mind I decided to create the Notification Bar Magento extension to improve the notification bar experience both for the site administrators and users/customers. This paid extension has the following benefits over that simple implementation described above:
- Simple configuration from the Magento Admin: System > Configuration > Design > Notification Bar
- Ability to style the notification bar to match your theme
- Your notification bar content may contain plain text, HTML, as well as template tags
- Give visitors the option to close and dismiss the notification bar
- Optionally name the current notification bar so that when you have a new message to announce, it will be displayed for all visitors of your site, even those who closed a previous notification
- Set a notification start date, to set your message to automatically display on a specified date
- Set a notification end date, to hide your message automatically on a specified date, if desired
- Either fix the notification bar to the top of the browser so that it scrolls with the page always on top, or leave it with the less intrusive default behavior.
If you just need a simple notification bar, give my example above a try, but if you’d like to take advantage of these additional features, please consider the Notification Bar extension. As always, if you have any issues or questions get in touch, or leave a comment below if you have suggestions or feature requests. Thanks!
The post Adding a Notification Bar to Magento appeared first on SkyVerge.