Customer Model Magento

While working in Magento, you might have seen that there are various model defined like sales,catalog etc.

I am writing here a script for working with customer model.

<?php

$customerModel = Mage::getModel('customer/customer'); //get customer model

$customerCollection = $customerModel->getCollection();
$customers = array();
$i = 0;
foreach ($customerCollection as $customer)
{
	$customer = $customerModel->load($customer->getId());
	$customers[$i]['name'] = $customer->getName();
	$customers[$i]['email'] = $customer->getEmail();
	$i++;
}	

foreach($customers as $k => $v)
{
	echo 'Customer name :'.$v['name'];
        echo 'Customer Email :'.$v['email'];
        echo '<br/>';
}
?>

I hope it is useful to you.

2 thoughts on “Customer Model Magento

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top