1

In Magento i want to search the customer with the address(state,city,zipcode), can you explain to me how to the achieve that.

The customer collection query

$collection = Mage::getModel('customer/customer')->getCollection();
$collection->addAttributeToSelect(array('userid','firstname','lastname','profile_image','specialist','latitude','free_consult','longitude'));
$collection->addAttributeToFilter('group_id',Federallawyer_Customer_Helper_Data::LAWYER);

also my shipping and billing address is same.

Pradeep Sanku
9,2662 gold badges42 silver badges75 bronze badges
asked Jul 15, 2015 at 11:06
0

1 Answer 1

3
$collection = Mage::getModel('customer/customer')->getCollection()
 ->joinAttribute('billing_postcode', 'customer_address/postcode', '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_postcode','123456') // replace with your post code
 ->addFieldToFilter('billing_city','test') // replace with your city
 ->addFieldToFilter('billing_region','test') // replace with your region
answered Jul 15, 2015 at 11:14

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.