Home » Magento9 February 2011

Magento: How to search or filter by multiselect attribute in admin grid?

Suppose you have a multi select attribute and you have displayed it in admin grid. You have displayed the multi select attribute options as selection list. Now, you want to filter/search the grid by the multiselect attribute.

The problem here is that the multiselect attribute value is store as comma separated value in database. When we send single value from the selection list, the filter doesn’t work properly.

The solution is to use filter_condition_callback in addColumn.

Here is the code:-

The callback function is:-

The similar thing is done in Mage_Adminhtml_Block_Cms_Block_Grid class to filter Store View.

Hope this helps. Thanks.


Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed
  • Grewals

    Hey, maybe somebody knows how to display in product grid labels of options for multiselect attribute instead of ids?

  • Rait

    Hey Mukesh,

    nice blog you have here. Finding it extremely useful. Keep up the good work!

    In the meantime, maybe you can help me on the right tracks with my problem. I am trying to filter the products that are displayed on the “Assigned Products” tab of the “Configurable Product” edit page.

    The actual filtering is not the issue, but finding the method that’s responsible for retrieving that list, is. At first I thought it was the _prepareCollection() method from the Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid.php file. Howver, it turns ot this is not the case.

  • Felixgmca

    how will search in catalog_product page in magento

  • max

    Wonderful! Thanks for this blog Mukesh Chapagain!

  • Ricky

    Cool snippet, thank you Mukesh, I’m using it on manage product grid, but cats dropdown is empty, what I have to do to filter by categories the pruduct list?

  • Andreas

    Works perfectly, thank you!

  • sandeep verma

    For frontend Layer Search : – I need to find query text in attribute color,size,category please suggets

    Ex:- like user enter “Black 36” (search result should show all the combination with Black and size 36 using AND not with OR )

  • Magento Developer

    Alternatively you can also use: _addColumnFilterToCollection() method

  • Andis

    Hi Mukesh,

    I am using webkul marketplace extension and want to creategory filter with market place product grid section in admin. Already implement category showing in market place product grid but filtering is not working. I need help regarding this.


  • pawan sharma

    Hello @Grewals and @Mukesh
    Please let me know how can we show multiple selected value in grid list.
    My that values are not from attributes, Its hard-coded in form.php file.

    Please reply, Thanks