00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 class Mage_Adminhtml_Block_Sales_Order_Create_Customer_Grid extends Mage_Adminhtml_Block_Widget_Grid
00033 {
00034
00035 public function __construct()
00036 {
00037 parent::__construct();
00038 $this->setId('sales_order_create_customer_grid');
00039 $this->setRowClickCallback('order.selectCustomer.bind(order)');
00040 $this->setUseAjax(true);
00041 $this->setDefaultSort('entity_id');
00042 }
00043
00044 protected function _prepareCollection()
00045 {
00046 $collection = Mage::getResourceModel('customer/customer_collection')
00047 ->addNameToSelect()
00048 ->addAttributeToSelect('email')
00049 ->addAttributeToSelect('created_at')
00050 ->joinAttribute('billing_postcode', 'customer_address/postcode', 'default_billing', null, 'left')
00051 ->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left')
00052 ->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing', null, 'left')
00053 ->joinAttribute('billing_regione', 'customer_address/region', 'default_billing', null, 'left')
00054 ->joinAttribute('billing_country_id', 'customer_address/country_id', 'default_billing', null, 'left')
00055 ->joinField('store_name', 'core/store', 'name', 'store_id=store_id', null, 'left');
00056
00057 $this->setCollection($collection);
00058
00059 return parent::_prepareCollection();
00060 }
00061
00062 protected function _prepareColumns()
00063 {
00064 $this->addColumn('entity_id', array(
00065 'header' =>Mage::helper('sales')->__('ID'),
00066 'width' =>'50px',
00067 'index' =>'entity_id',
00068 'align' => 'right',
00069 ));
00070 $this->addColumn('name', array(
00071 'header' =>Mage::helper('sales')->__('Name'),
00072 'index' =>'name'
00073 ));
00074 $this->addColumn('email', array(
00075 'header' =>Mage::helper('sales')->__('Email'),
00076 'width' =>'150px',
00077 'index' =>'email'
00078 ));
00079 $this->addColumn('Telephone', array(
00080 'header' =>Mage::helper('sales')->__('Telephone'),
00081 'width' =>'100px',
00082 'index' =>'billing_telephone'
00083 ));
00084 $this->addColumn('billing_postcode', array(
00085 'header' =>Mage::helper('sales')->__('ZIP/Post Code'),
00086 'width' =>'120px',
00087 'index' =>'billing_postcode',
00088 ));
00089 $this->addColumn('billing_country_id', array(
00090 'header' =>Mage::helper('sales')->__('Country'),
00091 'width' =>'100px',
00092 'type' =>'country',
00093 'index' =>'billing_country_id',
00094 ));
00095 $this->addColumn('billing_regione', array(
00096 'header' =>Mage::helper('sales')->__('State/Province'),
00097 'width' =>'100px',
00098 'index' =>'billing_regione',
00099 ));
00100
00101 if (!Mage::app()->isSingleStoreMode()) {
00102 $this->addColumn('store_name', array(
00103 'header' =>Mage::helper('sales')->__('Signed Up From'),
00104 'align' => 'center',
00105 'index' =>'store_name',
00106 'width' =>'130px',
00107 ));
00108 }
00109
00110 return parent::_prepareColumns();
00111 }
00112
00113
00114
00115
00116 public function getRowId($row)
00117 {
00118 return $row->getId();
00119 }
00120
00121 public function getRowUrl($row)
00122 {
00123 return $row->getId();
00124 }
00125
00126 public function getGridUrl()
00127 {
00128 return $this->getUrl('*/*/loadBlock', array('block'=>'customer_grid'));
00129 }
00130
00131 }