1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27: 28: 29: 30: 31: 32: 33:
34: class Mage_Adminhtml_Model_Search_Order extends Varien_Object
35: {
36: 37: 38: 39: 40:
41: public function load()
42: {
43: $arr = array();
44:
45: if (!$this->hasStart() || !$this->hasLimit() || !$this->hasQuery()) {
46: $this->setResults($arr);
47: return $this;
48: }
49:
50: $query = $this->getQuery();
51:
52: $collection = Mage::getResourceModel('sales/order_collection')
53: ->addAttributeToSelect('*')
54: ->addAttributeToSearchFilter(array(
55: array('attribute' => 'increment_id', 'like'=>$query.'%'),
56: array('attribute' => 'billing_firstname', 'like'=>$query.'%'),
57: array('attribute' => 'billing_lastname', 'like'=>$query.'%'),
58: array('attribute' => 'billing_telephone', 'like'=>$query.'%'),
59: array('attribute' => 'billing_postcode', 'like'=>$query.'%'),
60:
61: array('attribute' => 'shipping_firstname', 'like'=>$query.'%'),
62: array('attribute' => 'shipping_lastname', 'like'=>$query.'%'),
63: array('attribute' => 'shipping_telephone', 'like'=>$query.'%'),
64: array('attribute' => 'shipping_postcode', 'like'=>$query.'%'),
65: ))
66: ->setCurPage($this->getStart())
67: ->setPageSize($this->getLimit())
68: ->load();
69:
70: foreach ($collection as $order) {
71: $arr[] = array(
72: 'id' => 'order/1/'.$order->getId(),
73: 'type' => Mage::helper('adminhtml')->__('Order'),
74: 'name' => Mage::helper('adminhtml')->__('Order #%s', $order->getIncrementId()),
75: 'description' => $order->getBillingFirstname().' '.$order->getBillingLastname(),
76: 'form_panel_title' => Mage::helper('adminhtml')->__('Order #%s (%s)', $order->getIncrementId(), $order->getBillingFirstname().' '.$order->getBillingLastname()),
77: 'url' => Mage::helper('adminhtml')->getUrl('*/sales_order/view', array('order_id'=>$order->getId())),
78: );
79: }
80:
81: $this->setResults($arr);
82:
83: return $this;
84: }
85: }
86: