when customer login to site, it should display "welcome customer" at top of the site.

assume customer will login to site. after customer login, in top of the site there

should be a some message to welcome customer.

how to display welcome " customer_name" at the top of the site.

please help me to find solution.

thanks in advance.


I think that is what you are looking for:


public function getWelcome()
    if (empty($this->_data['welcome'])) {
        if (Mage::app()->isInstalled() && Mage::getSingleton('customer/session')->isLoggedIn()) {
            $this->_data['welcome'] = $this->__('Welcome, %s!', Mage::getSingleton('customer/session')->getCustomer()->getName());
        } else {
            $this->_data['welcome'] = Mage::getStoreConfig('design/header/welcome');

    return $this->_data['welcome'];

So it looks like Mage::getSingleton('customer/session')->getCustomer() will get your current logged in customer ;)

| improve this answer | |
  • hi, can you please tell me which code i have to replace by " Mage::getSingleton('customer/session')->getCustomer()" – Baby in Magento Feb 17 '15 at 9:49
  • 1
    Did you check under "app/code/core/Mage/Page/Block/Html/Header.php" if you have the function getWelcome() like the one above? – Klettseb Feb 17 '15 at 9:54
  • 1
    yes and does your function look the same than this one above? – Klettseb Feb 17 '15 at 9:56
  • 1
    yes so it works for you or not when you are logged in? – Klettseb Feb 17 '15 at 9:57
  • 1
    Let us continue this discussion in chat. – Klettseb Feb 17 '15 at 10:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.