2

I am simply wondering if there are additional side-effects of turning on Demo Store Mode. Aside from the notice that is displayed on the front and backend, is there any ordering functionality that is disabled as well?

I'd like to use the demo store notice to add a global message to the site (I will change the wording) and want to make sure this won't disable some other feature that I am not aware of.

4

I did a quick search for demonotice in the code and did not find a lot of usages of this demo notice:

  • app/code/core/Mage/Adminhtml/Block/Page/Notices.php

    public function displayDemoNotice()
    
  • app/code/core/Mage/Page/Block/Html/Notices.php

    public function displayDemoNotice()
    
  • app/code/core/Mage/Page/etc/system.xml

    <demonotice translate="label comment">...</demonotice>
    
  • app/design/adminhtml/default/default/template/page/notices.phtml

    <?php if ($this->displayDemoNotice()): ?>
    
  • app/design/frontend/base/default/template/page/html/notices.phtml

    <?php if ($this->displayDemoNotice()): ?>
    

The displayDemoNotice method does only check for the system configuration value.

/**
  * Check if demo store notice should be displayed
  *
  * @return boolean
  */
 public function displayDemoNotice()
 {
     return Mage::getStoreConfig('design/head/demonotice');
 }

While it seems harmless to use the demo notice for other messages and does not limit functionality, I would recommend to extend the Mage_Adminhtml_Block_Page_Notices (frontend) and Mage_Adminhtml_Block_Page_Notices (backend) blocks and add your own system configuration value

In your system.xml add a new value like this:

<config>
    <sections>
        <design translate="label" module="core">
            <groups>
                <head translate="label">
                     <fields>
                         <yourglobalnotice translate="label comment">
                            <label>Display Demo Store Notice</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                            <sort_order>80</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </yourglobalnotice>
                         <yourglobalnoticetext translate="label comment">
                            <label>Demo Store Notice Message</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>90</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </yourglobalnoticetext>
                      </fields>
                </head>
            </groups>
        </design>
    </sections>
</config>

By adding the global message as system variable to, you can edit it from the backend and don't have to hardcode it in the template file. You can then retrieve the text in the templates via Mage::getStoreConfig('design/head/yourglobalnoticetext');.

1
  • 1
    I do intend to add a proper block/module for this after rebuild. In this case I am working with a site that is going EOL in the next week or so, so I'm not really interested in working on new code, no matter how trivial it may be.
    – pspahn
    Mar 30 '16 at 18:54

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.