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_Report_Review_Product_Grid extends Mage_Adminhtml_Block_Widget_Grid
00035 {
00036
00037 public function __construct()
00038 {
00039 parent::__construct();
00040 $this->setId('gridProducts');
00041 $this->setDefaultSort('review_cnt');
00042 $this->setDefaultDir('desc');
00043 }
00044
00045 protected function _prepareCollection()
00046 {
00047 $collection = Mage::getResourceModel('reports/review_product_collection')
00048 ->joinReview();
00049
00050 $this->setCollection($collection);
00051
00052 return parent::_prepareCollection();
00053 }
00054
00055 protected function _prepareColumns()
00056 {
00057
00058 $this->addColumn('entity_id', array(
00059 'header' =>Mage::helper('reports')->__('ID'),
00060 'width' =>'50px',
00061 'index' =>'entity_id'
00062 ));
00063
00064 $this->addColumn('name', array(
00065 'header' => Mage::helper('reports')->__('Product Name'),
00066 'index' => 'name'
00067 ));
00068
00069 $this->addColumn('review_cnt', array(
00070 'header' =>Mage::helper('reports')->__('Number of Reviews'),
00071 'width' =>'50px',
00072 'align' =>'right',
00073 'index' =>'review_cnt'
00074 ));
00075
00076 $this->addColumn('avg_rating', array(
00077 'header' =>Mage::helper('reports')->__('Avg. rating'),
00078 'width' =>'50px',
00079 'align' =>'right',
00080 'index' =>'avg_rating'
00081 ));
00082
00083 $this->addColumn('avg_rating_approved', array(
00084 'header' =>Mage::helper('reports')->__('Avg. approved rating'),
00085 'width' =>'50px',
00086 'align' =>'right',
00087 'index' =>'avg_rating_approved'
00088 ));
00089
00090 $this->addColumn('last_created', array(
00091 'header' =>Mage::helper('reports')->__('Last Review'),
00092 'width' =>'150px',
00093 'index' =>'last_created',
00094 'type' =>'datetime'
00095 ));
00096
00097 $this->addColumn('action', array(
00098 'header' => Mage::helper('reports')->__('Action'),
00099 'width' => '100px',
00100 'align' => 'center',
00101 'filter' => false,
00102 'sortable' => false,
00103 'renderer' => 'adminhtml/report_grid_column_renderer_product'
00104 ));
00105
00106 $this->setFilterVisibility(false);
00107
00108 $this->addExportType('*/*/exportProductCsv', Mage::helper('reports')->__('CSV'));
00109 $this->addExportType('*/*/exportProductExcel', Mage::helper('reports')->__('Excel'));
00110
00111 return parent::_prepareColumns();
00112 }
00113
00114 public function getRowUrl($row)
00115 {
00116 return $this->getUrl('*/catalog_product_review/', array('productId' => $row->getId()));
00117 }
00118 }