*/ class Mage_Adminhtml_Model_Search_Customer extends Varien_Object { /** * Load search results * * @return Mage_Adminhtml_Model_Search_Customer */ public function load() { $arr = array(); if (!$this->hasStart() || !$this->hasLimit() || !$this->hasQuery()) { $this->setResults($arr); return $this; } $collection = Mage::getResourceModel('customer/customer_collection') ->addNameToSelect() ->joinAttribute('company', 'customer_address/company', 'default_billing', null, 'left') ->addAttributeToFilter(array( array('attribute'=>'firstname', 'like' => $this->getQuery().'%'), array('attribute'=>'lastname', 'like' => $this->getQuery().'%'), array('attribute'=>'company', 'like' => $this->getQuery().'%'), )) ->setPage(1, 10) ->load(); foreach ($collection->getItems() as $customer) { $arr[] = array( 'id' => 'customer/1/'.$customer->getId(), 'type' => Mage::helper('adminhtml')->__('Customer'), 'name' => $customer->getName(), 'description' => $customer->getCompany(), 'url' => Mage::helper('adminhtml')->getUrl('*/customer/edit', array('id'=>$customer->getId())), ); } $this->setResults($arr); return $this; } }