I made a custom module in admin section for seller management. I updated the details using a CSV file. There are about 200 entries. Now, when I try to go to the next page, it redirects to the same page.
The search bar on top of each column in the grid is also not working. When I try to search an entry using the search bar, it redirects me to the same page again.
This is the code of my block.
class COC_Managesellers_Block_Adminhtml_Managesellers extends Mage_Adminhtml_Block_Widget_Grid_Container
{
public function __construct()
{
$this->_controller = 'adminhtml_managesellers';
$this->_blockGroup = 'managesellers';
$this->_headerText = Mage::helper('managesellers')->__('Seller Manager');
parent::__construct();
}
}
Grid.php
public function __construct()
{
parent::__construct();
$this->setId('sellerGrid');
$this->setDefaultSort('managesellers_id');
$this->setDefaultDir('ASC');
$this->setSaveParametersInSession(true);
$this->setUseAjax(true);
$this->setVarNameFilter('product_filter');
}
protected function _getStore()
{
$storeId = (int) $this->getRequest()->getParam('store', 0);
return Mage::app()->getStore($storeId);
}
protected function _prepareCollection()
{
$store = $this->_getStore();
$collection = Mage::getModel('managesellers/managesellers')->getCollection();
$this->setCollection($collection);
parent::_prepareCollection();
return $this;
}
protected function _addColumnFilterToCollection($column)
{
if ($this->getCollection()) {
if ($column->getId() == 'websites') {
$this->getCollection()->joinField('websites',
'managesellers/product_website',
'website_id',
'seller_id=managesellers_id',
null,
'left');
}
}
return parent::_addColumnFilterToCollection($column);
}
protected function _prepareColumns()
{
$this->addColumn('managesellers_id',
array(
'header'=> Mage::helper('managesellers')->__('ID'),
'width' => '50px',
'index' => 'managesellers_id',
));
$this->addColumn('name',
array(
'header'=> Mage::helper('managesellers')->__('Name'),
'index' => 'name',
));
$this->addColumn('address',
array(
'header'=> Mage::helper('managesellers')->__('Address'),
'index' => 'address',
));
$this->addColumn('shipping_charges',
array(
'header'=> Mage::helper('managesellers')->__('Shipping Charges'),
'index' => 'shipping_charges',
));
$this->addColumn('min_value',
array(
'header'=> Mage::helper('managesellers')->__('Minimum Order Value'),
'index' => 'min_value',
));
$this->addColumn('action',
array(
'header' => Mage::helper('managesellers')->__('Action'),
'width' => '50px',
'type' => 'action',
'getter' => 'getId',
'actions' => array(
array(
'caption' => Mage::helper('managesellers')->__('Edit'),
'url' => array(
'base'=>'*/*/edit',
'params'=>array('managesellers_id'=>$this->getRequest()->getParam('managesellers_id'))
),
'field' => 'managesellers_id'
)
),
'filter' => false,
'sortable' => false,
'index' => 'managesellers_id',
));
return parent::_prepareColumns();
}
protected function _prepareMassaction()
{
$this->setMassactionIdField('managesellers_id');
$this->getMassactionBlock()->setFormFieldName('managesellers_id');
$this->getMassactionBlock()->addItem('delete', array(
'label'=> Mage::helper('managesellers')->__('Delete'),
'url' => $this->getUrl('*/*/massDelete'),
'confirm' => Mage::helper('managesellers')->__('Are you sure?')
));
Mage::dispatchEvent('adminhtml_managesellers_grid_prepare_massaction', array('block' => $this));
return $this;
}
public function getGridUrl()
{
return $this->getUrl('*/*/grid', array('_current'=>true));
}
public function getRowUrl($row)
{
return $this->getUrl('*/*/edit', array(
'store'=>$this->getRequest()->getParam('store'),
'managesellers_id'=>$row->getId())
);
}
How can I make them work ?
Please help.