1

I have a Magento store with a custom theme loaded. The site is ready to go for the most part, but I'd like to add a small message on the top that parts of it are still under construction and problems might occur.

Is there an easy, foolproof way to do this?

1
  • open you header.phtml file of your template and add the message
    – lavb
    Oct 20 '14 at 23:53
1

Use the core magento 'demo store' notification system. It will be the most reliable.

In admin enable it under 'system->configuration->Design'

demo store notification

Then copy the template notices.phtml to your theme, and edit as needed.

You will be interested in the part :

<?php if ($this->displayDemoNotice()): ?>
    <div class="global-site-notice demo-notice">
        <div class="notice-inner"><p><?php echo $this->__('This is a demo store. Any orders placed through this store will not be honored or fulfilled.') ?></p></div>
    </div>
<?php endif; ?>

and style as needed, via css.

Alternatively, you can also just place a different message via the language file of your site, replacing the message with your own, which will not require you to copy the .phtml file.

If you want to display this on a per-page basis, you can use some custom layout xml, and add some filters to the notice block.

in local.xml use :

<default>
  <reference name="global_notices">
    <action name="setUnderConstructionNotice" json="value">
      <value><![CDATA[{"0" : "cms_index_index", "1" : "PRODUCT_123"}]]></value>
    </action>
  </reference>
</default>

The xml above will inject a new variable, as an array, into the notices block, which you can then ref via conditionals to test if the page you are on should have the notice. I am sure you can work that bit of code out for yourself.

If you need to set notice on a per cms page, or category page, my Global Handle extension on GitHib https://github.com/ProxiBlue/GlobalHandle would be of use, as it will inject the name of the cms/category page into the handles available

CMS_ example CMS_about_us
CATEGORY_ example CATEGORY_best_sellers

Hope that helps...

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.