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
00035 class Mage_Adminhtml_Block_Catalog_Search_Grid extends Mage_Adminhtml_Block_Widget_Grid
00036 {
00037
00038
00039
00040
00041 public function __construct()
00042 {
00043 parent::__construct();
00044 $this->setId('catalog_search_grid');
00045 $this->setDefaultSort('name');
00046 $this->setDefaultDir('ASC');
00047 $this->setSaveParametersInSession(true);
00048 }
00049
00050
00051
00052
00053
00054
00055 protected function _prepareCollection()
00056 {
00057 $collection = Mage::getModel('catalogsearch/query')
00058 ->getResourceCollection();
00059 $this->setCollection($collection);
00060 return parent::_prepareCollection();
00061 }
00062
00063
00064
00065
00066
00067
00068 protected function _prepareColumns()
00069 {
00070
00071
00072
00073
00074
00075
00076 $this->addColumn('search_query', array(
00077 'header' => Mage::helper('catalog')->__('Search Query'),
00078 'index' => 'query_text',
00079 ));
00080
00081 if (!Mage::app()->isSingleStoreMode()) {
00082 $this->addColumn('store_id', array(
00083 'header' => Mage::helper('catalog')->__('Store'),
00084 'index' => 'store_id',
00085 'type' => 'store',
00086 'store_view' => true,
00087 'sortable' => false
00088 ));
00089 }
00090
00091 $this->addColumn('num_results', array(
00092 'header' => Mage::helper('catalog')->__('Results'),
00093 'index' => 'num_results',
00094 'type' => 'number'
00095 ));
00096
00097 $this->addColumn('popularity', array(
00098 'header' => Mage::helper('catalog')->__('Number of Uses'),
00099 'index' => 'popularity',
00100 'type' => 'number'
00101 ));
00102
00103 $this->addColumn('synonim_for', array(
00104 'header' => Mage::helper('catalog')->__('Synonym for'),
00105 'align' => 'left',
00106 'index' => 'synonim_for',
00107 'width' => '160px'
00108 ));
00109
00110 $this->addColumn('redirect', array(
00111 'header' => Mage::helper('catalog')->__('Redirect'),
00112 'align' => 'left',
00113 'index' => 'redirect',
00114 'width' => '200px'
00115 ));
00116
00117 $this->addColumn('display_in_terms', array(
00118 'header'=>Mage::helper('catalog')->__('Display in Suggested Terms'),
00119 'sortable'=>true,
00120 'index'=>'display_in_terms',
00121 'type' => 'options',
00122 'width' => '100px',
00123 'options' => array(
00124 '1' => Mage::helper('catalog')->__('Yes'),
00125 '0' => Mage::helper('catalog')->__('No'),
00126 ),
00127 'align' => 'left',
00128 ));
00129 $this->addColumn('action',
00130 array(
00131 'header' => Mage::helper('catalog')->__('Action'),
00132 'width' => '100px',
00133 'type' => 'action',
00134 'getter' => 'getId',
00135 'actions' => array(array(
00136 'caption' => Mage::helper('catalog')->__('Edit'),
00137 'url' => array(
00138 'base'=>'*/*/edit'
00139 ),
00140 'field' => 'id'
00141 )),
00142 'filter' => false,
00143 'sortable' => false,
00144 'index' => 'catalog',
00145 ));
00146 return parent::_prepareColumns();
00147 }
00148
00149
00150
00151
00152
00153
00154 protected function _prepareMassaction()
00155 {
00156 $this->setMassactionIdField('query_id');
00157 $this->getMassactionBlock()->setFormFieldName('search');
00158
00159 $this->getMassactionBlock()->addItem('delete', array(
00160 'label' => Mage::helper('catalog')->__('Delete'),
00161 'url' => $this->getUrl('*/*/massDelete'),
00162 'confirm' => Mage::helper('catalog')->__('Are you sure?')
00163 ));
00164
00165 return parent::_prepareMassaction();
00166 }
00167
00168
00169
00170
00171
00172
00173 public function getRowUrl($row)
00174 {
00175 return $this->getUrl('*/*/edit', array('id' => $row->getId()));
00176 }
00177
00178 }