2

I'm trying to call customer first name on one page. The page has already been restricted to logged in members only. So if you try to access the page and you haven't logged in, you will be redirected to login page.

How do I call, echo or display a logged in customer's first name on one specific CMS page?

I'm a noob trying to learn magento. Any help is highly appreciated.

7ochem
  • 2,183
  • 1
  • 34
  • 42
Vim Bonsu
  • 1,852
  • 6
  • 21
  • 28

2 Answers2

5

Magento Customers First Name get in Logged in users

$session = Mage::getSingleton('customer/session');

if($session->isLoggedIn())
{
    $customer = $session->getCustomer();
    echo $customer->getFirstname();
}

Try to implement the above code to display the Customer First name your CMS Page.

2

To get a customer name in a .phtml file

   echo Mage::helper('customer')->getCustomerName();

Read more @ Current user in Magento?

To get the customer name in a cms page, I would call a phtml file from the cms page using

 {{block type="core/template" template="path/to/file/customer_name.phtml"}}

Read more @ how to call a PHTML file within a CMS page Magento

Community
  • 1
  • 1
MagePal Extensions
  • 17,646
  • 2
  • 47
  • 62