Menu Close
    Hire us Request quote Reading list Switch to dark mode

    Adding a new column in PrestaShop new Symfony admin controller grid page with module

    Prestashop 1.7.x.x now have a new admin controller page on Symfony architecture where now listing is displayed with PrestaShop grid component.

    So if we need to add any new column in the list using the module we need to follow not new hooks provided, there are two hooks mainly,

    ‘actionCustomerGridDefinitionModifier’ to add a new column

    ‘actionCustomerGridQueryBuilderModifier’ to provide data to the column

    In my example, I am adding a normal text type display column on the customer controller,

    For this, we need to use these namespaces

    use PrestaShop\PrestaShop\Core\Grid\Column\Type\DataColumn;
    use PrestaShop\PrestaShop\Core\Grid\Filter\Filter;
    use Symfony\Component\Form\Extension\Core\Type\TextType;

    And in the hook function, this is the example code,

    the above code looks simple and understandable 🙂

    This code is providing the actionCustomerGridDefinitionModifier hook a custom data of customer entity.

    Now you can see your column here like this,

    PrestaShop also provided multiple column types, you can refer to this and use accordingly.

    See this blog if you want to create your custom column type.

    . . .

    Comments (2)

    Add Your Comment

  • langziyang
    add new column and use sql is ok,but if only want add new column likt option,do not has sql,how to do that
    • Dheeraj Sharma
      then do not use the second hook, ‘actionCustomerGridQueryBuilderModifier’,
  • Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just received your message and our expert will get back to you shortly.
    Send Again
    Close