Categories
Magento

Magento – Get Logged In Customer’s Full Name, First Name, Last Name and Email Address

[php]
// Check if any customer is logged in or not
if (Mage::getSingleton(‘customer/session’)->isLoggedIn()) {

// Load the customer’s data
$customer = Mage::getSingleton(‘customer/session’)->getCustomer();

$customer->getPrefix();
$customer->getName(); // Full Name
$customer->getFirstname(); // First Name
$customer->getMiddlename(); // Middle Name
$customer->getLastname(); // Last Name
$customer->getSuffix();

// All other customer data
$customer->getWebsiteId(); // ID
$customer->getEntityId(); // ID
$customer->getEntityTypeId(); // ID
$customer->getAttributeSetId(); // ID
$customer->getEmail();
$customer->getGroupId(); // ID
$customer->getStoreId(); // ID
$customer->getCreatedAt(); // yyyy-mm-ddThh:mm:ss+01:00
$customer->getUpdatedAt(); // yyyy-mm-dd hh:mm:ss
$customer->getIsActive(); // 1
$customer->getDisableAutoGroupChange();
$customer->getTaxvat();
$customer->getPasswordHash();
$customer->getCreatedIn(); // Admin
$customer->getGender(); // ID
$customer->getDefaultBilling(); // ID
$customer->getDefaultShipping(); // ID
$customer->getDob(); // yyyy-mm-dd hh:mm:ss
$customer->getTaxClassId(); // ID
}
[/php]

29 replies on “Magento – Get Logged In Customer’s Full Name, First Name, Last Name and Email Address”

How can i get how many customar are login in magento. any one help me?

Thanks Jamie. You cannot get such information about the guest visitor. They haven’t given any personal data until they create an account. This will work for logged in customers only.

Mage::getSingleton(‘customer/session’)->isLoggedIn()

I’m too new to magento and I need to get the customer email, email validate if that exists, and if there is show your name, id and telephone could help. $getmail = Mage::getModel(customer/customer)->load();

I think we can use: $customer->getAddresses(), to get the addresses of the customer.

Comments are closed.