i am trying to filter grid by category without adding category column, is there a way by which we can do this custom filter to grid.

below is what i did

function prepareCollection()
$catIdArray = getRequest()->getParam('cat_id');
//i.e  $catIdArray = array(26, 27, 17);

$collection = Mage::getModel('catalog/product')->getCollection(); 

    array('in' => $catIdArray)

Here filter is working fine, but pagination doesn't work in this case. please suggest me what am i doing wrong????

1 Answer 1


Try this:

    'catalog/category_product', // table to join
    'product_id=entity_id', // ON statement, flat table first!
    array(), // don't add any columns
    array('in' => $categoryIds) // additional WHERE

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.