在 Prestashop 注册表中添加日期选择器(生日)
Add datepicker in prestashop registration form (birthdate)
在以前版本的 Prestashop 1.6 中,注册表单有生日字段的日期选择器和下拉列表,我们可以在其中 select 月、日、年。
Prestashop 版本 1.6 - 生日截图:
然后在最新版本的Prestashop 1.7.6+中,生日字段的注册表单没有日期选择器,我们需要在生日输入字段中手动输入日期。
Prestashop 版本 1.7.6+ - 生日截图:
我应该在哪里修改文件以显示日期选择器?
Prestashop 已经有了生日字段的辅助表单:
找到文件../classes/form/CustomerFormatter.php
在第 196 行将 setType('text')
更改为 setType('date')
:
if ($this->ask_for_birthdate) {
$format['birthday'] = (new FormField())
->setName('birthday')
->setType('date') //change this to date
->setLabel(
$this->translator->trans(
'Birthdate',
[],
'Shop.Forms.Labels'
)
)
在以前版本的 Prestashop 1.6 中,注册表单有生日字段的日期选择器和下拉列表,我们可以在其中 select 月、日、年。
Prestashop 版本 1.6 - 生日截图:
然后在最新版本的Prestashop 1.7.6+中,生日字段的注册表单没有日期选择器,我们需要在生日输入字段中手动输入日期。
Prestashop 版本 1.7.6+ - 生日截图:
我应该在哪里修改文件以显示日期选择器?
Prestashop 已经有了生日字段的辅助表单:
找到文件../classes/form/CustomerFormatter.php
在第 196 行将 setType('text')
更改为 setType('date')
:
if ($this->ask_for_birthdate) {
$format['birthday'] = (new FormField())
->setName('birthday')
->setType('date') //change this to date
->setLabel(
$this->translator->trans(
'Birthdate',
[],
'Shop.Forms.Labels'
)
)