Magento 1 - Show Firstname or Lastname Only In Welcome Message

Posted on June 23, 2011 | Magento 1

If you would like to change the default welcome message in magento from "Welcome, Paul Donnelly" to "Hi Paul" or "Hello Mr Donnelly", use the following snippets within
app\design\frontend\default\default\template\page\html\header.phtml

Firstname

echo $this->__('Hi %s', Mage::getSingleton('customer/session')->getCustomer()->getFirstname());

Lastname

 echo $this->__('Hello Mr %s', Mage::getSingleton('customer/session')->getCustomer()->getLastname());