I would like to change the welcome message to just show initials. Clearly I can do something in the template, however, I would like to extend/over-ride Mage_Page_Block_Html_Welcome to do this 'the proper way'.
I have tried doing this however I cannot get it to work - I just get a blank line. I am expecting the normal line with 'TEST' written in there too:
Here is my config.xml entry:
<global>
<blocks>
<page>
<rewrite>
<html_welcome>MyCompany_Mymodule_Page_Block_Html_Welcome</html_welcome>
</rewrite>
</page>
</blocks>
My code, just copied from the original file with a small change for test porpoises:
app/code/local/MyCompany/Mymodule/Block/Page/Html/Welcome.php
<?php class MyCompany_Mymodule_Page_Block_Html_Welcome extends Mage_Page_Block_Html_Welcome {
/**
* Get block messsage
*
* @return string
*/
protected function _toHtml()
{
if (empty($this->_data['welcome'])) {
if (Mage::isInstalled() && Mage::getSingleton('customer/session')->isLoggedIn()) {
$this->_data['welcome'] = $this->__('TEST Welcome, %s!', $this->escapeHtml(Mage::getSingleton('customer/session')->getCustomer()->getName()));
} else {
$this->_data['welcome'] = Mage::getStoreConfig('design/header/welcome');
}
}
return $this->_data['welcome'];
}
/**
* Get tags array for saving cache
*
* @return array
*/
public function getCacheTags()
{
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
$this->addModelTags(Mage::getSingleton('customer/session')->getCustomer());
}
return parent::getCacheTags();
}
}
$this->_data['welcome'] = "test.";
? Are you trying to see message logged in ?etc/modules
?