magento 1.9: How to load customers by mobile number
You can search by below code, you can set your attribute value instead of telephone:
$telephone = '32423423';
$result = Mage::getModel('customer/customer')
->getCollection()
->addAttributeToSelect('*')
->addAttributeToFilter('telephone', $telephone) //replace your attribute of mobile
->load();
if (is_object($result)) {
//set your code...
}
At magento telephone is Customer address attribute.
If you want to get Customer details from telephone then you need to check Customer Id from Mage::getModel('customer/address')
model.
$CustomAddress=Mage::getModel('customer/address')->getCollection()->addAttributeToFilter('telephone',$YourValue)->getFirstItem();
$customerId= $CustomAddress->getCustomerId($CustomAddress);
Then using Customer id,You can get Custome data by load Customer model
$customer = Mage::getModel(‘customer/customer’)->load($customerId);