1

I am trying to get all the customers details according to their state wise for example collection of all customers from arizona.

Code:

$collection = array();
$collection = Mage::getResourceModel('customer/customer_collection')
    ->joinAttribute('company', 'customer_address/company', 'default_billing', null, 'left')
    ->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left')
    ->joinAttribute('billing_region', 'customer_address/region', 'default_billing', null, 'left')
    ->addFieldToFilter('billing_region',$stateName)
    ->setOrder('billing_city', 'asc');
echo $stateName;   
echo $collection->getSelect();
print_r($collection); 
return $collection;

Now when i display the query and run it in sql it was working fine but the collection is not displaying anything.

Any help would be appreciated !!!!

Keyur Shah
  • 11,043
  • 4
  • 29
  • 48

1 Answers1

0

Try to load the collection:

->setOrder('billing_city', 'asc')->load(); 
Bogdan
  • 89
  • 2