Magento

How to get logged in user details in Magento?

Hello friends today I will explain you how to check the user is logged in or not and if it it logged in then how to fetch the detail of user in Magento.

For that you have to follow below code

<?php
 $CusSession=mage::getSingleton('customer/session');
    //Checking customer is logged in or not
    if($CusSession->isLoggedIn())
    {
        $customer    = $CusSession->getCustomer();    //get Customer object		
        $name        = $customer->getName();		
		$customerEmail = $customer->getEmail();
		$customerFirstname = $customer->getFirstname();
		$customerLastname = $customer->getLastname();		
		echo $customercustomername;
    }	
	else
	{
		echo "Customer is not logged in";
	}
?>

Hope it is helpful to you find customer details

Advertisements

2 thoughts on “How to get logged in user details in Magento?

  1. I got this site from my buddy who shared with me regarding this site and
    now this time I am browsing this website and reading very informative articles
    at this place.

Leave your comments

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s