Magento – Welcome – Message on CMS page / Show in CMS block

the standard “welcome”-Message from Magento is known for a long time. It is usually displayed at the top in the header and often disappears again.

Picture

But if you want this “welcome”-Message not in the header but at a desired location e.g.. have on the home page, is this not so easy but-if you know how- but rel. quickly.

  1. If you create a file e.g.. with the name “welcome-cms.phtml” im Ordner app / design / frontend /[Eigenes Theme]/[Eigenes Theme]/template/page/html
  2. Here you copied purely following code:
    <div>
        <p class="welcome-cms"><?php if (empty($this->_data['welcome'])) {
                if (Magus::isInstalled() && Magus::getSingleton('Customer / session')->isLoggedIn()) {
                    $this->_data['welcome'] = $this->__('Welcome, %s!', $this->escapeHtml(Magus::getSingleton('Customer / session')->getCustomer()->getName()));
                } else {
                    $this->_data['welcome'] = Mage::getStoreConfig('design/header/welcome');
                }
            }
    
            echo $this->_data['welcome']; ?></p>
    </div>
  3. Saving, Upload. With this code, the default welcome text appears a non-logged-in visitors now, the one in the backend under System > Configuration > Design > “Visible head area” – “welcome text” can enter. If the user is logged but, will give him “Welcome, [his name]” displayed. This can now be adjusted directly in the file or about the translation. This was with us in the page.csv be found in app / locale / en_US and there as “Welcome, %s” guided.
  4. Now in the desired CMS page, the variable
    {{block type="page/html" template ="page/html/welcome_cms.phtml"}}

    inserted.

  5. Last must now (Magento >= 1.9) the authorization are set for the block. This is done by subjecting System > permissions > Blocks makes a new entry and “page/html” allowed.
  6. Now, in the front end, the welcome message should appear beautiful. It can now be mockup directly from the admin or via the CSS with the class “.welcome-cms”

Used in Magento Version 1.9 Comments? Additions? Notes? Gladly!

Published by Covos

Since 2009 I have been working intensively with Magento. I started with the creation and operation of B2C stores. This was extended through my work in the logistics sector. This resulted first specialized B2E systems. Today I work day-a day with exciting B2C, B2B- and B2E projects and reports in this blog about challenges and give insider tips.

Leave a Reply

Your email address will not be published. Required fields are marked *