Jump to content

Edit History

MaXi32

MaXi32


mistake

I can see prestashop already has helper form of birthday field:

Find the file ../classes/form/CustomerFormatter.php

in line 196 change the setType('text') to setType('date'):

if ($this->ask_for_birthdate) {
    $format['birthday'] = (new FormField())
        ->setName('birthday')
        ->setType('text')   //change this to date
        ->setLabel(
            $this->translator->trans(
                'Birthdate',
                [],
                'Shop.Forms.Labels'
            )
        )

 

When I use that type birthday I got the populated field like prestashop 1.6 but, it doesn't work when saving. So, I think the birthday type is deprecated helper. Any help ?

MaXi32

MaXi32

I can see prestashop already has helper form of birthday field:

Find the file ../classes/form/CustomerFormatter.php

in line 196 change the setType('text') to setType('birthday'):

if ($this->ask_for_birthdate) {
    $format['birthday'] = (new FormField())
        ->setName('birthday')
        ->setType('text')   //change this to birthday
        ->setLabel(
            $this->translator->trans(
                'Birthdate',
                [],
                'Shop.Forms.Labels'
            )
        )

 

When I use that type birthday I got the populated field like prestashop 1.6 but, it doesn't work when saving. So, I think the birthday type is deprecated helper. Any help ?

MaXi32

MaXi32

Ok, I found the answer, prestashop already has helper form of birthday field:

Find the file ../classes/form/CustomerFormatter.php

in line 196 change the setType('text') to setType('birthday'):

if ($this->ask_for_birthdate) {
    $format['birthday'] = (new FormField())
        ->setName('birthday')
        ->setType('text')   //change this to birthday
        ->setLabel(
            $this->translator->trans(
                'Birthdate',
                [],
                'Shop.Forms.Labels'
            )
        )

 

×
×
  • Create New...