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
00033
00034 class Mage_Adminhtml_Block_Customer_Edit_Tab_Reviews extends Mage_Adminhtml_Block_Widget_Grid
00035 {
00036
00037 public function __construct()
00038 {
00039 parent::__construct();
00040 $this->setId('reviewsGrid');
00041 $this->setUseAjax(true);
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')
00051 ->joinAttribute('billing_city', 'customer_address/city', 'default_billing')
00052 ->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing')
00053 ->joinAttribute('billing_country_id', 'customer_address/country_id', 'default_billing');
00054
00055 $this->setCollection($collection);
00056
00057 return parent::_prepareCollection();
00058 }
00059
00060 protected function _prepareColumns()
00061 {
00062 $this->addColumn('entity_id', array(
00063 'header' => Mage::helper('customer')->__('ID'),
00064 'width' => 5,
00065 'align' => 'center',
00066 'sortable' => true,
00067 'index' => 'entity_id'
00068 ));
00069
00070 $this->addColumn('name', array(
00071 'header' => Mage::helper('customer')->__('Name'),
00072 'index' => 'name'
00073 ));
00074
00075 $this->addColumn('email', array(
00076 'header' => Mage::helper('customer')->__('Email'),
00077 'width' => 40,
00078 'align' => 'center',
00079 'index' => 'email'
00080 ));
00081
00082 $this->addColumn('telephone', array(
00083 'header' => Mage::helper('customer')->__('Telephone'),
00084 'align' => 'center',
00085 'index' => 'billing_telephone'
00086 ));
00087
00088 $this->addColumn('billing_postcode', array(
00089 'header' => Mage::helper('customer')->__('ZIP/Postal Code'),
00090 'index' => 'billing_postcode',
00091 ));
00092
00093 $this->addColumn('billing_country_id', array(
00094 'header' => Mage::helper('customer')->__('Country'),
00095 'type' => 'country',
00096 'index' => 'billing_country_id',
00097 ));
00098
00099 $this->addColumn('customer_since', array(
00100 'header' => Mage::helper('customer')->__('Customer Since'),
00101 'type' => 'date',
00102 'format' => 'Y.m.d',
00103 'index' => 'created_at',
00104 ));
00105
00106 $this->addColumn('action',
00107 array(
00108 'header' => Mage::helper('customer')->__('Action'),
00109 'width' => '50px',
00110 'type' => 'action',
00111 'getter' => 'getId',
00112 'actions' => array(
00113 array(
00114 'caption' => Mage::helper('customer')->__('Edit'),
00115 'url' => array(
00116 'base'=>'*/catalog_product_review/edit'
00117 ),
00118 'field' => 'id'
00119 )
00120 ),
00121 'filter' => false,
00122 'sortable' => false,
00123 ));
00124
00125 $this->setColumnFilter('entity_id')
00126 ->setColumnFilter('email')
00127 ->setColumnFilter('name');
00128
00129 $this->addExportType('*/*/exportCsv', Mage::helper('customer')->__('CSV'));
00130 $this->addExportType('*/*/exportXml', Mage::helper('customer')->__('XML'));
00131 return parent::_prepareColumns();
00132 }
00133
00134 public function getGridUrl()
00135 {
00136 return $this->getUrl('*/*/index', array('_current'=> true));
00137 }
00138
00139 public function getRowUrl($row)
00140 {
00141 return $this->getUrl('*/catalog_product_review/edit', array('id'=>$row->getId()));
00142 }
00143
00144
00145 }