Read More
Read More
Menu Close

    Remove columns and filters from a back-office grid in PrestaShop 1.7

    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.

    before_remove_from_order_list

    We will get it only by changing in module main file.

    Searching for an experienced
    Prestashop Company ?
    Read More

    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.

    after_remove_from_order_list

    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].

    . . .
    Discuss on Helpdesk

    Leave a Comment

    Your email address will not be published. Required fields are marked*


    Be the first to comment.

    Back to Top