Get logged in customer details magento
Posted by navaneeth on Sep 26, 2013 in Magento | No comments yet

Here we are discussing about how to get logged in customer details.Below code shows how we can achieve that
$customerData = Mage::getSingleton('customer/session')->getCustomer(); $cdata=$customerData->getData();
Before using this code make sure to check whether a user is logged in or not by this code
if(Mage::getSingleton('customer/session')->isLoggedIn()): //code endif;
As a whole the code look like this
if(Mage::getSingleton('customer/session')->isLoggedIn()): $customerData = Mage::getSingleton('customer/session')->getCustomer(); $cdata=$customerData->getData(); endif;
The variable $cdata will return the array consisting of the required details
So by using this code we can get logged in customer details
Leave a Reply