I would like to have the same welcome message for all users which you type in at the backend Configuration > Design > Header
.
The only difference should be that the logged in users should have their name out front.
For example: the not logged in users should see
"Hello welcome to our store!"
and the ones who are logged in should see
"Mr Brown. Hello welcome to our store!"
So I guess I have to change the code on the following file:
code > local > Mage > Page > Block > Html > Header.php
I tried the following but it didn't work:
/**
* Retrieve page welcome message
*
* @deprecated after 1.7.0.2
* @see Mage_Page_Block_Html_Welcome
* @return mixed
*/
public function getWelcome()
{
if (empty($this->_data['welcome'])) {
if (Mage::isInstalled() && Mage::getSingleton('customer/session')->isLoggedIn()) {
$this->_data['welcome'] = Mage::getStoreConfig('design/header/welcome') & $this->__('%s!', $this->escapeHtml(Mage::getSingleton('customer/session')->getCustomer()->getName()));
} else {
$this->_data['welcome'] = Mage::getStoreConfig('design/header/welcome');
}
}
return $this->_data['welcome'];
}
}
I'm not good at coding so it would be great if someone could help me on this. Thanks.
getWelcome
function you are editing. This is deprecated after Magento CE 1.7.0.2.