How to Manage Displaying of Sales Order Grid Columns in Magento

How to Manage Displaying of Sales Order Grid Columns in Magento

In this article I explained how to delete columns from sales order grid. Now basing on this functionality, we will find out how to implement the dynamic filter for columns in sales order grid.

First of all you need to change config.xml and add and add 2 sections to global:

Then we build a list of elements for displaying the filter in the helper/Data.php file.

Then it’s possible to add a filter layout on the page by adding the block to the file belvg/ordershinegrid.xml

and the layout itself in the template file belvg/sales/grid/column/filter.phtml

In this file it’s necessary to pay attention to the event onchange=”sales_order_gridJsObject.doFilter()” – it will allow using the default grid.js in order to refresh content after applying the filter.

In order to make the filter start transferring the “column-filter” parameters, let’s redefine the doFilter() method in the file js/belvg/adminhtml/ordershinegrid.js


Now the filter is displayed on order sales page:

How to Manage Displaying of Sales Order Grid Columns in Magento

Last step is to monitor and delete filter columns selected  Model/Observer.php

As a result only the columns with checkboxes selected will be displayed:

How to Manage Displaying of Sales Order Grid Columns in Magento



Post a new comment

top