In this blog, we are going to learn how to remove columns and filters from the BO grid.
So let’s see together how to do that with PrestaShop.
Sometimes, we need to remove unnecessary columns to improve the user interface.
Now, We are going to remove the ‘New client‘ column from the order list page.
We will get it only by changing in module main file.
Thanks to the available hooks, it’s super easy to remove columns from a grid!
We will register the ‘actionOrderGridDefinitionModifier‘ hook in our module using the below code.
$this->registerHook( array( 'actionOrderGridDefinitionModifier', ) );
After registering, We will do the below code in our module main file.
public function hookActionOrderGridDefinitionModifier(array $params) { /** @var GridDefinitionInterface $definition */ $definition = $params['definition']; /** @var ColumnCollection */ $columns = $definition->getColumns(); $columns->remove('new'); /** @var FilterCollection $filters */ $filters = $definition->getFilters(); $filters->remove('new'); }
Now, You will see the ‘New client’ column will be removed from the order list page.
Like an order list grid, Each grid has a ‘Definition‘ hook to alter the grid.
The customer list grid has an id customer and an ‘actionCustomerGridDefinitionModifier‘ hook.
You can use it for other lists also using action<GridDefinitionId>GridDefinitionModifier
Here <GridDefinitionId> will be replaced by your grid id.
That’s all about this blog. Hope it will help you.
If you are facing any issues or doubts in the above process, please feel free to contact us through the comment section.
We would be happy to help.
Also, you can explore our PrestaShop Development Services & a large range of quality PrestaShop Modules.
For any doubt contact us at [email protected].
Be the first to comment.