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: class Mage_Adminhtml_Block_Sales_Order_Create_Customer_Grid extends Mage_Adminhtml_Block_Widget_Grid
33: {
34:
35: public function __construct()
36: {
37: parent::__construct();
38: $this->setId('sales_order_create_customer_grid');
39: $this->setRowClickCallback('order.selectCustomer.bind(order)');
40: $this->setUseAjax(true);
41: $this->setDefaultSort('entity_id');
42: }
43:
44: protected function _prepareCollection()
45: {
46: $collection = Mage::getResourceModel('customer/customer_collection')
47: ->addNameToSelect()
48: ->addAttributeToSelect('email')
49: ->addAttributeToSelect('created_at')
50: ->joinAttribute('billing_postcode', 'customer_address/postcode', 'default_billing', null, 'left')
51: ->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left')
52: ->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing', null, 'left')
53: ->joinAttribute('billing_regione', 'customer_address/region', 'default_billing', null, 'left')
54: ->joinAttribute('billing_country_id', 'customer_address/country_id', 'default_billing', null, 'left')
55: ->joinField('store_name', 'core/store', 'name', 'store_id=store_id', null, 'left');
56:
57: $this->setCollection($collection);
58:
59: return parent::_prepareCollection();
60: }
61:
62: protected function _prepareColumns()
63: {
64: $this->addColumn('entity_id', array(
65: 'header' =>Mage::helper('sales')->__('ID'),
66: 'width' =>'50px',
67: 'index' =>'entity_id',
68: 'align' => 'right',
69: ));
70: $this->addColumn('name', array(
71: 'header' =>Mage::helper('sales')->__('Name'),
72: 'index' =>'name'
73: ));
74: $this->addColumn('email', array(
75: 'header' =>Mage::helper('sales')->__('Email'),
76: 'width' =>'150px',
77: 'index' =>'email'
78: ));
79: $this->addColumn('Telephone', array(
80: 'header' =>Mage::helper('sales')->__('Telephone'),
81: 'width' =>'100px',
82: 'index' =>'billing_telephone'
83: ));
84: $this->addColumn('billing_postcode', array(
85: 'header' =>Mage::helper('sales')->__('ZIP/Post Code'),
86: 'width' =>'120px',
87: 'index' =>'billing_postcode',
88: ));
89: $this->addColumn('billing_country_id', array(
90: 'header' =>Mage::helper('sales')->__('Country'),
91: 'width' =>'100px',
92: 'type' =>'country',
93: 'index' =>'billing_country_id',
94: ));
95: $this->addColumn('billing_regione', array(
96: 'header' =>Mage::helper('sales')->__('State/Province'),
97: 'width' =>'100px',
98: 'index' =>'billing_regione',
99: ));
100:
101: $this->addColumn('store_name', array(
102: 'header' =>Mage::helper('sales')->__('Signed Up From'),
103: 'align' => 'center',
104: 'index' =>'store_name',
105: 'width' =>'130px',
106: ));
107:
108: return parent::_prepareColumns();
109: }
110:
111: 112: 113:
114: public function getRowId($row)
115: {
116: return $row->getId();
117: }
118:
119: public function getRowUrl($row)
120: {
121: return $row->getId();
122: }
123:
124: public function getGridUrl()
125: {
126: return $this->getUrl('*/*/loadBlock', array('block'=>'customer_grid'));
127: }
128:
129: }
130: