*/ class Mage_Adminhtml_Block_Catalog_Search_Grid extends Mage_Adminhtml_Block_Widget_Grid { /** * Init Grid default properties * */ public function __construct() { parent::__construct(); $this->setId('catalog_search_grid'); $this->setDefaultSort('name'); $this->setDefaultDir('ASC'); $this->setSaveParametersInSession(true); } /** * Prepare collection for Grid * * @return Mage_Adminhtml_Block_Catalog_Search_Grid */ protected function _prepareCollection() { $collection = Mage::getModel('catalogsearch/query') ->getResourceCollection(); $this->setCollection($collection); return parent::_prepareCollection(); } /** * Prepare Grid columns * * @return Mage_Adminhtml_Block_Catalog_Search_Grid */ protected function _prepareColumns() { /*$this->addColumn('query_id', array( 'header' => Mage::helper('catalog')->__('ID'), 'width' => '50px', 'index' => 'query_id', ));*/ $this->addColumn('search_query', array( 'header' => Mage::helper('catalog')->__('Search Query'), 'index' => 'query_text', )); if (!Mage::app()->isSingleStoreMode()) { $this->addColumn('store_id', array( 'header' => Mage::helper('catalog')->__('Store'), 'index' => 'store_id', 'type' => 'store', 'store_view' => true, 'sortable' => false )); } $this->addColumn('num_results', array( 'header' => Mage::helper('catalog')->__('Results'), 'index' => 'num_results', 'type' => 'number' )); $this->addColumn('popularity', array( 'header' => Mage::helper('catalog')->__('Number of Uses'), 'index' => 'popularity', 'type' => 'number' )); $this->addColumn('synonym_for', array( 'header' => Mage::helper('catalog')->__('Synonym For'), 'align' => 'left', 'index' => 'synonym_for', 'width' => '160px' )); $this->addColumn('redirect', array( 'header' => Mage::helper('catalog')->__('Redirect'), 'align' => 'left', 'index' => 'redirect', 'width' => '200px' )); $this->addColumn('display_in_terms', array( 'header'=>Mage::helper('catalog')->__('Display in Suggested Terms'), 'sortable'=>true, 'index'=>'display_in_terms', 'type' => 'options', 'width' => '100px', 'options' => array( '1' => Mage::helper('catalog')->__('Yes'), '0' => Mage::helper('catalog')->__('No'), ), 'align' => 'left', )); $this->addColumn('action', array( 'header' => Mage::helper('catalog')->__('Action'), 'width' => '100px', 'type' => 'action', 'getter' => 'getId', 'actions' => array(array( 'caption' => Mage::helper('catalog')->__('Edit'), 'url' => array( 'base'=>'*/*/edit' ), 'field' => 'id' )), 'filter' => false, 'sortable' => false, 'index' => 'catalog', )); return parent::_prepareColumns(); } /** * Prepare grid massaction actions * * @return Mage_Adminhtml_Block_Catalog_Search_Grid */ protected function _prepareMassaction() { $this->setMassactionIdField('query_id'); $this->getMassactionBlock()->setFormFieldName('search'); $this->getMassactionBlock()->addItem('delete', array( 'label' => Mage::helper('catalog')->__('Delete'), 'url' => $this->getUrl('*/*/massDelete'), 'confirm' => Mage::helper('catalog')->__('Are you sure?') )); return parent::_prepareMassaction(); } /** * Retrieve Row Click callback URL * * @return string */ public function getRowUrl($row) { return $this->getUrl('*/*/edit', array('id' => $row->getId())); } }