Hello!
I want to create a radio field that would allow the user to choose in which group their account will be created (eg: individuals, professionals). And if the "Professionals" button is checked, the SIRET and Company fields will appear. I modified CustomerFormatter.php to get the radio field I want, but I don't know how to persist the information to database as well.
$groups = Group::getGroups($this->language->id);
$groupField = (new FormField())
->setName('id_default_group')
->setType('radio-buttons')
->setLabel(
$this->translator->trans(
'Statut',
[],
'Shop.Forms.Labels'
)
);
foreach ($groups as $group) {
$groupField->addAvailableValue($group->id_group,$group->name);
// var_dump($group);
}
I tried this, but Prestashop gives me an error: ContextErrorException
Notice: Trying to get property 'id_group' of non-object
However with a vardump, I do have an "id_group" output (I was inspired by "Gender")
Thanks in advance!