i am adding multiple columns in magento order grid they are working fine as separate filter but when choose multiple column nothing shown
if ($block->getId() == 'sales_order_grid') {
$data=Mage::getModel('name/name')->getCollection()->setOrder('position','ASC');
foreach($data as $dat)
{
$block->addColumnAfter(
'some name',
array(
'header' => 'name',
'align' => 'left',
'index' => $dat->getId(),
'renderer' => 'renderer class',
'sortable' => false,
'type' => 'options',
'options' => $this->_getOptions($dat->getId()),
'filter_condition_callback' => array($this, '_filtercolumn'),
),
'id_of_column_to_be_after'
);
$block->sortColumnsByOrder();
}
}
this is filter code
public function _filtercolumn($collection, $column)
{
if (!$value = trim($column->getFilter()->getValue())) {
return;
}
$collection->getSelect()->join('tablename')->where("`tablename`.order_id=`main_table`.entity_id AND `tablename`.column1='$value' AND `tablename`.column2='$columnid'");
$collection->printLogQuery(true);
return $collection;
}