In this example we are showing how to get customer details by email Id.We have gotten email id, but we need to get the details of a customer using the email id. Here is the solution to get the customer data using the email id.Here’s how to do it.
<?php $email = "email@example.com"; $customer = Mage::getModel("customer/customer")->setWebsiteId(Mage::app()->getWebsite()->getId())->loadByEmail($email); //use echo $customer->getId(); echo $customer->getEmail(); echo $customer->getFirstname(); ?>
In Magento we can do share the customers across the websites. It means a customer can be member of many stores. Similarly you can set customer for only one store. So a customer can register to website A and with the same email id he can register to Website B. So that I used Mage::app()->getWebsite()->getId() to seperate the customer one store to another.