Magento grid disable sorting and filtering

Magento grid disable sorting and filtering

July 2, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento grid disable sorting and filtering

Disabling Sorting and Filtering on Magento Grid Columns

If you’re working with Magento grids and need to disable sorting or filtering for specific columns, this guide will walk you through the process step-by-step.

Understanding Magento Grid Sorting and Filtering

By default, many of the built-in grids in Magento allow users to sort data by clicking column headers and filter rows using input fields. However, there may be cases where you want to restrict these functionalities for certain columns.

Disabling Sorting on a Column

To disable sorting for a particular grid column, you need to override the grid’s collection model. Here’s how:

  1. Create an extension that overrides the relevant grid’s collection class.
  2. In your custom collection model, override the getSelect method.
  3. Remove the ORDER BY clause from the generated SQL.

For example, let’s say we want to disable sorting on the “status” column of the products grid:

class MyModule_Backend_Model_Resource_Catalog_Product_Collection extends Mage_Catalog_Model_Resource_Product_Collection
{
    protected function _getSelect()
    {
        $select = parent::_getSelect();
        if ($this->isSortingDisabled('status')) {
            $select->reset(Zend_Db_Select::ORDER);
        }
        return $select;
    }

    private function isSortingDisabled($field)
    {
        // Add your logic here to determine when sorting should be disabled
        // For simplicity, let's disable it for the "status" field

        if ($field == 'status') {
            return true;
        }
        return false;
    }
}

Disabling Filtering on a Column

Disabling filtering is more straightforward. You can simply remove the input fields from the grid pager block.

  1. Create an extension that overrides the relevant grid’s pager block.
  2. In your custom block, override the getFilter method and return an empty array for the desired column(s).

Continuing with our “status” example:

class MyModule_Backend_Block_Adminhtml_Catalog_Product_Pager extends Mage_Adminhtml_Block_Widget_Grid_Pager
{
    public function getFilter()
    {
        $filters = parent::getFilter();

        if (isset($filters['status'])) {
            unset($filters['status']);
        }

        return $filters;
    }
}

How to Implement This in Your Project

To actually implement these changes, you’ll need to create an extension and define the custom collection model and pager block. You can follow our guide on How to Create a Magento Extension for detailed instructions.

Conclusion

Disabling sorting and filtering on specific columns in Magento grids is a common requirement, especially when you want to restrict administrative access or improve performance by limiting query complexity. By using the techniques described here, you can easily customize your grid views without requiring complex core hacks.

Remember, always test your changes thoroughly in a development environment before deploying to production. For more advanced customizations and best practices, consider reaching out to an experienced Magento developer or contacting our team at Laravel Company.

Catalog Database API Extensions

Our network