In the previous version of Prestashop 1.6 the registration form has datepicker for birthday field with a dropdown list where we can select month, day, year.
Prestashop Version 1.6 [screenshot]
Then in the latest version of Prestashop 1.7.6.7, the registration form for the birthdate field doesn't have datepicker, we need to manually type in date in the birthdate input field.
Prestashop Version 1.7.6.7 [screenshot]
In prestashop 1.6 this is the code how the date dropdown appear:
<div class="form-group"> <label> {l s='Date of Birth'} </label> <div class="row"> <div class="col-xs-4"> <select name="days" id="days" class="form-control"> <option value="">-</option> {foreach from=$days item=v} <option value="{$v}" {if ($sl_day == $v)}selected="selected"{/if}>{$v} </option> {/foreach} </select> </div> <div class="col-xs-4"> {* {l s='January'} {l s='February'} {l s='March'} {l s='April'} {l s='May'} {l s='June'} {l s='July'} {l s='August'} {l s='September'} {l s='October'} {l s='November'} {l s='December'} *} <select id="months" name="months" class="form-control"> <option value="">-</option> {foreach from=$months key=k item=v} <option value="{$k}" {if ($sl_month == $k)}selected="selected"{/if}>{l s=$v} </option> {/foreach} </select> </div> <div class="col-xs-4"> <select id="years" name="years" class="form-control"> <option value="">-</option> {foreach from=$years item=v} <option value="{$v}" {if ($sl_year == $v)}selected="selected"{/if}>{$v} </option> {/foreach} </select> </div> </div> </div>
In prestashop 1.7, the registration template is located at .. /templates/customer/_partials/customer-form.tpl. In prestashop 1.7, this is the code how the date appear looping the form:
<form action="{block name='customer_form_actionurl'}{$action}{/block}" id="customer-form" class="js-customer-form" method="post"> <section> {block "form_fields"} {foreach from=$formFields item="field"} {block "form_field"} {form_field field=$field} {/block} {/foreach} {$hook_create_account_form nofilter} {/block} </section> ... </form>
My question is how to edit this date field before it populate data. Like:
{if $field['name'] == 'birthday''}
// Change birthdate field here to dropdown
{/if}
Any idea ?