Friday 7 February 2014

Get all customer data in Magento programatically

 with the below piece of code you will be able to load all data of all users with there address and all other information


<?php
$customer_email = "rhtgoel7@gmail.com";
$customer = Mage::getModel("customer/customer")->getCollection()->load();
echo"<pre>";
$custdata = $customer->getData();
foreach($custdata as $custdata1 ) {
//print_r($custdata1);
$custemail[] = $custdata1['email'];
}
print_r($custemail);
$customer_email = "rhtgoel7@gmail.com";
foreach( $custemail as $custemail1 ) {
$customer = Mage::getModel("customer/customer");
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$customer->loadByEmail($custemail1); //load customer by email id
//use
echo $customer->getId();
echo $customer->getFirstName();
print_r($customer->getData());

}
?>

No comments:

Post a Comment