Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How to move the welcome message to its own block
 
copperlab
Jr. Member
 
Total Posts:  19
Joined:  2009-02-05
 

Hello, I use a full page cache solution and am having a problem where the welcome message gets cached as a logged in user instead of the default welcome message set in the admin.

What I need to do is move the welcome message to its own block that can then be dynamically pulled in through the full page cache.

Has anyone come across this problem before that can help me create a block for the welcome message.  I am new to this so a step by step explanation would be super helpful.

Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
copperlab
Jr. Member
 
Total Posts:  19
Joined:  2009-02-05
 

I think I have made some progress for this problem.  However I am not getting the solution.  What I have done is created a new block in the app/design/frontend/default/layout/page.xml file. 
I have added this:

<block type="page/html_welcome" name="testwelcome" as="testwelcome"/>

There seems to be a built in core function called “welcome”.  It can be viewed at app/code/core/Mage/Page/Block/Html/Welcome.php.  So That is the reference in the page.xml file.

Then in the header.phtml file in app/design/frontend/default/template/page.html I placed a call for:

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

And finally I created a new template file called testwelcome.phtml in app/design/frontend/default/template with the following code:

<p class="welcome-msg"><?php echo $this->getWelcome() ?> <?php echo $this->getAdditionalHtml() ?></p>

I can get the welcome message to display, but I can’t seem to get it to render any changes.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top