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_Search_Grid extends Mage_Adminhtml_Block_Widget_Grid
00035 {
00036
00037
00038
00039
00040 public function __construct()
00041 {
00042 parent::__construct();
00043 $this->setId('searchReportGrid');
00044 $this->setDefaultSort('query_id');
00045 $this->setDefaultDir('desc');
00046 }
00047
00048
00049
00050
00051
00052
00053 protected function _prepareCollection()
00054 {
00055 $collection = Mage::getResourceModel('catalogsearch/query_collection');
00056 $this->setCollection($collection);
00057
00058 return parent::_prepareCollection();
00059 }
00060
00061
00062
00063
00064
00065
00066 protected function _prepareColumns()
00067 {
00068 $this->addColumn('query_id', array(
00069 'header' =>Mage::helper('reports')->__('ID'),
00070 'width' =>'50px',
00071 'filter' =>false,
00072 'index' =>'query_id',
00073 'type' =>'number'
00074 ));
00075
00076 $this->addColumn('query_text', array(
00077 'header' =>__('Search Query'),
00078 'filter' =>false,
00079 'index' =>'query_text'
00080 ));
00081
00082 if (!Mage::app()->isSingleStoreMode()) {
00083 $this->addColumn('store_id', array(
00084 'header' => Mage::helper('catalog')->__('Store'),
00085 'index' => 'store_id',
00086 'type' => 'store',
00087 'store_view' => true,
00088 'sortable' => false
00089 ));
00090 }
00091
00092 $this->addColumn('num_results', array(
00093 'header' =>Mage::helper('reports')->__('Results'),
00094 'width' =>'50px',
00095 'align' =>'right',
00096 'type' =>'number',
00097 'index' =>'num_results'
00098 ));
00099
00100 $this->addColumn('popularity', array(
00101 'header' =>Mage::helper('reports')->__('Hits'),
00102 'width' =>'50px',
00103 'align' =>'right',
00104 'type' =>'number',
00105 'index' =>'popularity'
00106 ));
00107
00108 $this->addExportType('*/*/exportSearchCsv', Mage::helper('reports')->__('CSV'));
00109 $this->addExportType('*/*/exportSearchExcel', Mage::helper('reports')->__('Excel'));
00110
00111 return parent::_prepareColumns();
00112 }
00113
00114
00115
00116
00117
00118
00119 public function getRowUrl($row)
00120 {
00121 return $this->getUrl('*/catalog_search/edit', array('id' => $row->getId()));
00122 }
00123 }
00124