Friday 14 June 2013

Magento – Get Customer Details By Email Id

- If we have customer email id and we need to get customer details,

- The following code will return customer object details,


<?php
$customer_email = "customer@example.com";
$customer = Mage::getModel("customer/customer");
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$customer->loadByEmail($customer_email); //load customer by email id
//use
echo $customer->getId();
echo $customer->getFirstName(); 
//print_r($customer->getData()); to find all the available elements. 
?> 

1 comment: