I am looking to something similar to this one (thats works with email), But instead of get the customer by email, i want to get him by the Tax/VAT number.
$customer = Mage::getModel('customer/customer')->setWebsiteId($website->getWebsiteId())->loadByEmail($customerEmail);
I found this example but its doesn't work.
$customer = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('*')->addFieldToFilter('taxvat', $ss_5_last)->load();
Thank you.
Best Answer
Try using this approach
Keep in mind vat_id is not unique and the code below can load multiple customers without
->getFirstItem()
.