Skip to content

Magento 1 module that allows filtering grid columns of type "options" by multiple values

License

Notifications You must be signed in to change notification settings

matheus-delazeri/magento1-grid-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Magento 1 Grid Helper

This is a very simple Magento 1 module that provides a new filter which allows filtering any grid column of type "Options" by more than one value at once! For example, this module rewrites the admin sales grid to add this new feature to the "Status" column:

image

This way you can filter the grid by more than one status option at once 😄

It also rewrites the catalog grid to make it possible to filter by more than one product type at time:

image

Adding to your grid

You can add this new filter to any grid's column of type "Options" in a VERY easy way: just paste the "filter" and "filter_condition_callback" parameters in the creation of your column:

...
$this->addColumn({column_id}, array(
      ...
      'type' => 'options',
      'options' => ['foo', 'bar'], 
      'filter' => 'gridhelper/adminhtml_widget_grid_column_filter_options',
      'filter_condition_callback' => [Delazeri_GridHelper_Block_Adminhtml_Widget_Grid_Column_Filter_Options::class, 'filterMultipleValuesCallback']
));
...

And you are good to go!🥳

e.g: Configuration of the "Status" column in the admin sales grid:

...
$this->addColumn('status', array(
      'header' => Mage::helper('sales')->__('Status'),
      'index' => 'status',
      'type'  => 'options',
      'width' => '70px',
      'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
      /** Delazeri_GridHelper configuration bellow */
      'filter' => 'gridhelper/adminhtml_widget_grid_column_filter_options',
      'filter_condition_callback' => [Delazeri_GridHelper_Block_Adminhtml_Widget_Grid_Column_Filter_Options::class, 'filterMultipleValuesCallback']
));
...

About

Magento 1 module that allows filtering grid columns of type "options" by multiple values

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published