Jump to content

add birthday years for use as delivery date


blackdroots

Recommended Posts

Friends, I have searched all installation files and I can not find the solution.

 

The "birthday" that has the fields "day", "month" and "year" I want to use as the delivery date. It turns out that the "year" extends only to 2002. My idea is to add more years to appear today and the years to come.

 

Where I can modify this part? to add the years that I need to appear? It is in the part of "authentication" in the part of "immediate purchase"

I'm using the 1.4.8 version of prestashop

 

I attached a screen print clearly explaining what I do.

 

I would appreciate a lot!

 

The site I'm doing what you can see in www.deepdesign.cl/tienda1483

post-343895-0-87884600-1349036321_thumb.jpg

Link to comment
Share on other sites

modify classes/tools.php

 

public static function dateYears()
{
 for ($i = date('Y') - 10; $i >= 1900; $i--)
  $tab[] = $i;
 return $tab;
}

 

change the -10 to a lower number including -0

 

 

Thank you very much!, I could add more years, but now I have another problem ... when validating the data says there is an error, the birthday is wrong. How I can fix this??

 

Thank you very much!

Link to comment
Share on other sites

hey, thanks for testing my suggestion...jajajaja

 

classes/validate.php

 

public static function isBirthDate($date)
{
  if (empty($date) || $date == '0000-00-00')
return true;
  if (preg_match('/^([0-9]{4})-((0?[1-9])|(1[0-2]))-((0?[1-9])|([1-2][0-9])|(3[01]))( [0-9]{2}:[0-9]{2}:[0-9]{2})?$/', $date, $birthDate)) {
if ($birthDate[1] >= date('Y') - 9)
 return false;
return true;
  }
 return false;
}

you could just comment out:

if ($birthDate[1] >= date('Y') - 9)
 return false;

 

don't forget the like button..for community members that try to help :)

  • Like 1
Link to comment
Share on other sites

hey, thanks for testing my suggestion...jajajaja

 

classes/validate.php

 

public static function isBirthDate($date)
{
  if (empty($date) || $date == '0000-00-00')
return true;
  if (preg_match('/^([0-9]{4})-((0?[1-9])|(1[0-2]))-((0?[1-9])|([1-2][0-9])|(3[01]))( [0-9]{2}:[0-9]{2}:[0-9]{2})?$/', $date, $birthDate)) {
if ($birthDate[1] >= date('Y') - 9)
 return false;
return true;
  }
 return false;
}

you could just comment out:

if ($birthDate[1] >= date('Y') - 9)
 return false;

 

don't forget the like button..for community members that try to help :)

 

 

thank you very much for responding so fast! ... but I did not understand this part "Could you just comment out":

 

thanks again

Link to comment
Share on other sites

here is the code with commented out code

public static function isBirthDate($date)
{
  if (empty($date) || $date == '0000-00-00')
   return true;
  if (preg_match('/^([0-9]{4})-((0?[1-9])|(1[0-2]))-((0?[1-9])|([1-2][0-9])|(3[01]))( [0-9]{2}:[0-9]{2}:[0-9]{2})?$/', $date, $birthDate)) {
//    if ($birthDate[1] >= date('Y') - 9)
//	 return false;
   return true;
  }
 return false;
}

  • Like 1
Link to comment
Share on other sites

here is the code with commented out code

public static function isBirthDate($date)
{
  if (empty($date) || $date == '0000-00-00')
return true;
  if (preg_match('/^([0-9]{4})-((0?[1-9])|(1[0-2]))-((0?[1-9])|([1-2][0-9])|(3[01]))( [0-9]{2}:[0-9]{2}:[0-9]{2})?$/', $date, $birthDate)) {
//	if ($birthDate[1] >= date('Y') - 9)
//	 return false;
return true;
  }
 return false;
}

 

 

It worked ok, thank you very much!. I can ask you the last question?

I'm doing this modification to use the birthday as "delivery date" ... What I can do to make this date appears in the mail warning that I get when I have a new sale?

 

And I thank you again, thanks for your time.

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...