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') { 
            foreach($data as $dat)
                'some name',
                    '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'),


this is filter code

public function _filtercolumn($collection, $column)
        if (!$value = trim($column->getFilter()->getValue())) { 
$collection->getSelect()->join('tablename')->where("`tablename`.order_id=`main_table`.entity_id AND `tablename`.column1='$value' AND  `tablename`.column2='$columnid'");


    return $collection;

1 Answer 1


Query is not wrote properly,please try this

$collection->getSelect()->join(array('tablename' => 'YOURTABLENAME'),
            'tablename.order_id = =`main_table`.entity_id'  
        AND `tablename`.column1='$value' AND  `tablename`.column2='$columnid'",

Make clone of collection on _filtercolumn function if required and then add join query on clone

$cloneCollection=clone $collection

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.