Thursday, 4 February 2016

How to retrieve a customer by phone number in magento?

$customer = Mage::getResourceModel('customer/address_collection')
    ->addAttributeToSelect('telephone')
    ->addAttributeToFilter('telephone', $phoneNumber)
    ->getFirstItem()->getCustomer();
if ($customer !== false) {
    // Do stuff...
}

No comments:

Post a Comment