我一直在为 magento 后端编写一个自定义模块,我想为每一列添加过滤器
谁能指出我处理此功能的代码在哪里的正确方向?我将假设它是控制器的一部分
感谢您的任何帮助,您可以提供!
我准备了这样的专栏
public function __construct()
{
parent::__construct();
$this->setId('main_grid');
$this->setDefaultSort('entity_id');
$this->setDefaultDir('DESC');
$this->setSaveParametersInSession(true);
$this->setUseAjax(true);
}
protected function _prepareCollection()
{
$model = Mage::getModel('CartAbandoned/tip');
$collection = $model->getCollection();
$this->setCollection($collection);
return parent::_prepareCollection();
}
$this->addColumn('id', array(
'header' => Mage::helper('CartAbandoned')->__('Id'),
'align' => 'right',
'width' => '50px',
'type' => 'number',
'index' => 'entity_id',
));
$this->addColumn('E-Mail', array(
'header' => Mage::helper('CartAbandoned')->__('EMail'),
'align' => 'left',
'width' => '150px',
'index' => 'customer_email',
'type' => 'text',
'truncate' => 50,
'escape' => true,
));
$this->addColumn('firstName', array(
'header' => Mage::helper('CartAbandoned')->__('firstName'),
'align' => 'left',
'index' => 'customer_firstname',
'type' => 'text',
'escape' => true,
));
$this->addColumn('lastName', array(
'header' => Mage::helper('CartAbandoned')->__('lastName'),
'align' => 'left',
'index' => 'customer_lastname',
'type' => 'text',
'escape' => true,
));
$this->addColumn('total', array(
'header' => Mage::helper('CartAbandoned')->__('Total'),
'align' => 'left',
'index' => 'base_grand_total',
'type' => 'price',
'escape' => true,
));
$this->addColumn('quan', array(
'header' => Mage::helper('CartAbandoned')->__('Quantity'),
'align' => 'left',
'index' => 'items_qty',
'type' => 'number',
'escape' => true,
));
$this->addColumn('cartcreatedtime', array(
'header' => Mage::helper('CartAbandoned')->__('cartcreatedtime'),
'align' => 'left',
'index' => 'created_at',
'type' => 'datetime',
'escape' => true,
));
$this->addColumn('cartabandonedtime', array(
'header' => Mage::helper('CartAbandoned')->__('cartabandonedtime'),
'align' => 'left',
'index' => 'updated_at',
'type' => 'datetime',
'escape' => true,
));
$this->addColumn('action',array(
'header' => Mage::helper('CartAbandoned')->__('Action'),
'type' => 'action',
'getter' => 'getId',
'actions' => array(
array(
'caption' => Mage::helper('CartAbandoned')->__('View Products'),
'url' => array('base'=>'*/*/edit'),
'field' => 'id'
)
),
'filter' => false,
'sortable' => false
));