Hello
I'm trying to show a column in my customers list showing the group in which each customer belongs. I managed to create the column and get the data but
every customer is shown 3 times (because there are three customer groups)
I followed this to make it till here
https://devdocs.prestashop.com/1.7/development/components/grid/tutorials/modify-grid-in-module/
and used the following parts of code:
->addAfter(
'lastname',
(new DataColumn('group'))
->setName($translator->trans('group', [], 'Modules.wkloginbygroup'))
->setOptions([
'field' => 'group',
])
)
$searchQueryBuilder->addSelect(
'cg.`id_group` AS `group`'
);
$searchQueryBuilder->leftJoin(
'c',
'`' . pSQL(_DB_PREFIX_) . 'customer_group`',
'cg',
'cg.`id_customer` = c.`id_customer`'
);
but now I'm stuck or very tired
Can anyone help?
Thanks in advance