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_Tag_Product_Grid extends Mage_Adminhtml_Block_Widget_Grid
00035 {
00036
00037 public function __construct()
00038 {
00039 parent::__construct();
00040 $this->setId('gridProducts');
00041 }
00042
00043 protected function _prepareCollection()
00044 {
00045
00046 $collection = Mage::getResourceModel('reports/tag_product_collection');
00047
00048 $collection->addUniqueTagedCount()
00049 ->addAllTagedCount()
00050 ->addStatusFilter(Mage::getModel('tag/tag')->getApprovedStatus())
00051 ->addGroupByProduct();
00052
00053 $this->setCollection($collection);
00054 return parent::_prepareCollection();
00055 }
00056
00057 protected function _prepareColumns()
00058 {
00059
00060 $this->addColumn('entity_id', array(
00061 'header' =>Mage::helper('reports')->__('ID'),
00062 'width' =>'50px',
00063 'align' =>'right',
00064 'index' =>'entity_id'
00065 ));
00066
00067 $this->addColumn('name', array(
00068 'header' =>Mage::helper('reports')->__('Product Name'),
00069 'index' =>'name'
00070 ));
00071
00072 $this->addColumn('utaged', array(
00073 'header' =>Mage::helper('reports')->__('Number of Unique Tags'),
00074 'width' =>'50px',
00075 'align' =>'right',
00076 'index' =>'utaged'
00077 ));
00078
00079 $this->addColumn('taged', array(
00080 'header' =>Mage::helper('reports')->__('Number of Total Tags'),
00081 'width' =>'50px',
00082 'align' =>'right',
00083 'index' =>'taged'
00084 ));
00085
00086 $this->addColumn('action',
00087 array(
00088 'header' => Mage::helper('catalog')->__('Action'),
00089 'width' => '100%',
00090 'type' => 'action',
00091 'getter' => 'getId',
00092 'actions' => array(
00093 array(
00094 'caption' => Mage::helper('catalog')->__('Show Tags'),
00095 'url' => array(
00096 'base'=>'*/*/productDetail'
00097 ),
00098 'field' => 'id'
00099 )
00100 ),
00101 'filter' => false,
00102 'sortable' => false,
00103 'index' => 'stores',
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('*/*/productDetail', array('id'=>$row->getId()));
00117 }
00118
00119 }