Got an issue when trying to filter a joined column in my new grid items, redirecting me to dashboard. This only affects the join column, I can filter with no problem the other fields. The code:
public function __prepareCollection() { $ collection = Mage::getModel('catalog/product)->getCollection() ->addAttributeToSelect(array(name, supplier)); $ collection->joinLeft(array('sell' => 'table_sell','sell.product_id = e.entity_id', array('grid_field' => 'count(case when sell.status > 0 then sell.quantity else 0 end')) ->group('entity_id'); $ this->setCollection($ collection); return parent::_prepareCollection(); } protected function _prepareColumns() { $ this->addColumn('grid_field', array( 'header' => Mage::helper('custom')->__('Grid field'), 'type' => 'number', 'width' => '50px', 'index' => 'grid_field' )); } public function getGridUrl() { return $ this->getUrl('*/*/sellgrid', array('_current' => true)); }
I must say that the action controller responsible for retuning the grid is:
public function sellGridAction(){ $ this->loadLayout(); $ this->renderLayout(); }
Any ideas? I also tried:
$ collection->addFilterToMap('grid_column', 'sell.count(case when sell.status > 0 then sell.quantity else 0 end');
but no result.