public function getCustomerByPost($params) { $customer = $this->_getCustomer(); // Patch for custom Contact Us form with ability to change email or name of customer (HDMX-98) if ($customer->getId() > 0 && !isset($params['customer_email']) && !isset($params['customer_name'])) { return $customer; } $email = $params['customer_email']; $name = $params['customer_name']; $customers = Mage::getModel('customer/customer')->getCollection(); $customers->addAttributeToSelect('*')->addAttributeToFilter('email', $email); if ($customers->count() > 0) { return $customers->getFirstItem(); } $c = Mage::getModel('customer/customer'); $c->getEmail(); $c->setEmail('aaa'); /** @var Mage_Customer_Model_Customer $address */ $address = $customers->getFirstItem(); if ($address->getId()) { $customer = new Varien_Object(); $customer->setName($address->getName()); $customer->setEmail($address->getEmail()); $customer->setQuoteAddressId($address->getId()); return $customer; } $customer = new Varien_Object(); $customer->setName($name); $customer->setEmail($email); return $customer; }