I have a custom column on my sales order grid showing the ordered items sku's. Done by following the guide here. It worked well in previous versions but no longer does work correctly in

When I go to filter the column by any given sky, I get the error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'skus' in 'where clause', query was: SELECT COUNT(DISTINCT main_table.entity_id) FROM sales_flat_order_grid AS main_table INNER JOIN sales_flat_order_item ON sales_flat_order_item.order_id=main_table.entity_id WHERE (skus LIKE '%tst%')

Backtracing this, the query is from here:

    public function getSelectCountSql()
    $countSelect = parent::getSelectCountSql();

    if (Mage::app()->getRequest()->getControllerName() == 'sales_order') {
        $countSelect->columns("COUNT(DISTINCT main_table.entity_id)");

        $havingCondition = $countSelect->getPart(Zend_Db_Select::HAVING);
        if (count($havingCondition)) {
                str_replace("group_concat(`sales_flat_order_item`.sku SEPARATOR ', ')", 'sales_flat_order_item.sku', $havingCondition[0])


    return $countSelect;

In order to try rectify this I added 'filter_index' => 'sku', to my addColumnAfter, via a helper function.

This has fixed the above SQL error, but I am now faced with the below issue(s):

Filtering by multiple skus returns no result. i.e,

Filter by x,z, even if order has say sku's x,c,v,z,y, no result returned.

Also, Filtered result shows only the sku I am filtering by. i.e,

Filter by x, will only show x sku in the column even if the order has say items x, y and z.

How would I get it to work so the sku column shows all skus on the order when filtering and multiple sku filter?

My filter callback:

public function filterSkus($collection, $column)
    if (!$value = $column->getFilter()->getValue()) {
        return $this;

        "group_concat(`sales_flat_order_item`.sku SEPARATOR ', ') like ?", "%$value%");
    return $collection;

The helper function:

 public function getSkusColumnParams()
    return array(
        'header' => 'SKUs',
        'index' => 'skus',
        'filter_index' => 'sku',
        'type' => 'text',
        'filter_condition_callback' => array(Mage::getSingleton('Atwix_ExtendedGrid_model_observer'), 'filterSkus'),



  • Did you solve this we have the same error where filter_condition_callback is not respected in 1 grid ... M1 tries to filter by an EAV column that does not exist .. and hence we see an error – snh_nl yesterday
  • @snh_nl I didn't truly resolve the issue. But, adding 'filter_index' will fix it – Vaishal Patel 21 hours ago
  • This will work only for native attributes – snh_nl 4 hours ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.