Jump to content

Changing Years for Date of Birth ...


Recommended Posts

Hi,

 

I have successfully installed Prestashop 1.5.2.0

 

I have renamed Date of Birth to Date of Event

 

But the year is 2013 counting back to 1900

 

How can I make the date current year counting forward 5 years.

 

thanks in advance

Link to comment
Share on other sites

Sorry if I wasn't clear.

 

On check out, it asks for your date of birth. Because it is a birthdate the year starts at 2013 and counts back to 1900.

 

I have rename this question to ask the date of an event, for example the date you will go on holidays.

 

Because a holiday trip is in the future I need the year to start at 2013, and display the next 5 years. For example from 2013 till 2018

 

I see the months in authentication.tpl, but I do not know what to do to change the year.

 

thanks.

Link to comment
Share on other sites

Ah, I understand better! :P

In this file, the years' combo box is generated with the following code:

               	 <select id="years" name="years">
                       <option value="">-</option>
                       {foreach from=$years item=year}
                           <option value="{$year}" {if ($sl_year == $year)} selected="selected"{/if}>{$year}  </option>
                       {/foreach}
                   </select>

The $years array is created in AuthController.php, in the assignDate() function. Which relies on Tools::dateYears() to generate them.

I suggest to copy the last function to a dateFutureYears(), and to change assignDate() to use this one instead.

Doing this in overrides is preferable to make the changes to survive updates.

Link to comment
Share on other sites

Thanks PhiLho, a couple more questions.

 

In AuthController.php, I could not find: assignDate() function, and I didn't know where to find the file with dateYears() under tools.

 

This seems a bit over my knowledge. perhaps an easier alternative is to turn off the date of birth question, and just add another question with a text field.

 

Is there an easy way to add another question to the checkout process?

 

thanks in advance ...

Link to comment
Share on other sites

Note: I inspect 1.5.3 code, I don't know how much it changed from 1.5.2...

And Tools:dateYears() refers to the dateYears() function in the classes/Tools.php file.

 

Text field vs. three combo boxes can be argued: I prefer the former, as it is often faster to type a few digits than selecting values in three (lengthy) combo boxes. On the other hand, you have to check the value to ensure it has been correctly typed, but it isn't that hard.

 

"Is there an easy way to add another question to the checkout process?"

Easy? Not really... Even less if you are not a programmer.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...