我在Adminhtml中有自定義網格。如何將自定義過濾器添加到Magento中的Colum網格?
protected function _prepareCollection()
{
/* @var $collection Mage_Catalog_Model_Resource_Product_Collection */
$collection = Mage::getModel('catalog/product')->getCollection();
$collection->addAttributeToSelect('*');
$collection->joinField('category_id', 'catalog/category_product', 'category_id', 'product_id=entity_id', null, 'left');
$collection->groupByAttribute('entity_id');
$collection->addStaticField('category_id');
$collection->addExpressionAttributeToSelect('category_grp', 'GROUP_CONCAT(category_id)', 'category_id');
$this->setCollection($collection);
return parent::_prepareCollection();
}
protected function _prepareColumns()
{
parent::_prepareColumns();
$this->addColumn('category_id', array(
'header' => Mage::helper('newsletter')->__('Category'),
'index' => 'category_grp',
'type' => 'categories',
'options' => $options,
'align' => 'left',
// 'filter_index' => $this->_getFlatExpressionColumn('category'),
return $this;
}
category_grp是陣列INT
我的問題是如何能夠我添加過濾器到頭從田野過濾項列?
例如過濾器只用CATEGORY_ID = 7(category_grp是3,6,7,13)產品...
其實我有興趣學習如何創建一個自定義過濾器(如果可能的話)請分享信息,如果你發現任何東西 – WonderLand