Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

DOB Format Issues in customers.php


Platinum Games

Recommended Posts

Posted

Hello all,

 

i have run into a little issue with the admin/customers.php file

 

i have changed the cart DOB format to DD/MM/YYYY but when i open the customers.php file in admin i can not update the customers details from my end due to the DOB format being wrong, this is the code i have in the (admin/customers.php) file

 

 

if (checkdate(substr(tep_date_raw($customers_dob), 4, 2), substr(tep_date_raw($customers_dob), 6, 2), substr(tep_date_raw($customers_dob), 0, 4))) {

 

 

id this the code that makes the format ???

 

i need it to read DD/MM/YYYY

 

any help would be great, thanks in advance.

 

Ben

Thanks in advance!

 

Ben

Posted

Have you followed the instructions in UK-Based osCommerce 2.2 http://addons.oscommerce.com/info/2816

 

You may find Date of Birth PullDown http://addons.oscommerce.com/info/3778 usefull too.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Posted
Have you followed the instructions in UK-Based osCommerce 2.2 http://addons.oscommerce.com/info/2816

 

You may find Date of Birth PullDown http://addons.oscommerce.com/info/3778 usefull too.

thanks for the reply,

 

i had a look at the code in the first contrib but it does not have the admin/customer.php file so i can have a look at the code....

 

i have the rest of the site working with DD/MM/YYYY its just that one file i can't get to work...

 

thanks again.

 

Ben

Thanks in advance!

 

Ben

Posted

Well, I`ve added the pull down I mentioned to admin, so avoid any issue, I have not added that option to that contrib but its easy.

 

1. Add function to functions/html_output.php

 

 

////
// Creates a pull-down list for dates 
function tep_pull_down_date($name='date', $day='', $month='', $year='', $full=false, $mnth=false, $starty=''){
if ($day=='') {$day=date('d');}
if ($month=='') {$month=date('m');}
if ($year=='') {$year=date('Y');}
$endy=date('Y')-8;
if ($starty=='') {$starty=date('Y')-1;$endy=date('Y')+2;} 
$named = $name . 'd';
$namem = $name . 'm';
// Array for days
$days=array();
$days[] = array('id' => '00', 'text' => 'not');
for($i=1; $i<=31; $i++){
if(strlen($i)!= 2){
$j = '0' . $i;
} else {
$j = $i;
} 
$days[] = array('id' => $j, 'text' => $j); }

if ($mnth) {
$months = array(
array('id' => '00', 'text' => 'month'),
array('id' => '01', 'text' => TEXT_DATE_JAN),
array('id' => '02', 'text' => TEXT_DATE_FEB),
array('id' => '03', 'text' => TEXT_DATE_MAR),
array('id' => '04', 'text' => TEXT_DATE_APR),
array('id' => '05', 'text' => TEXT_DATE_MAY),
array('id' => '06', 'text' => TEXT_DATE_JUN),
array('id' => '07', 'text' => TEXT_DATE_JUL),
array('id' => '08', 'text' => TEXT_DATE_AUG),
array('id' => '09', 'text' => TEXT_DATE_SEP),
array('id' => '10', 'text' => TEXT_DATE_OCT),
array('id' => '11', 'text' => TEXT_DATE_NOV),
array('id' => '12', 'text' => TEXT_DATE_DEC));
} else {
$months[] = array('id' => '00', 'text' => 'set');
for($i=1; $i<=12; $i++){
if(strlen($i)!= 2){
$j = '0' . $i;
} else {
$j = $i;
} 
$months[] = array('id' => $j, 'text' => $j); }}

for($i=$starty; $i<=$endy; $i++){
$j = $i;
if ($full) {
$y = $i - 2000;
if(strlen($y)!= 2){
$j = '0' . $y;
} else {
$j = $y;
} }
$years[] = array('id' => $i, 'text' => $j); }
$field='';
// mm dd yy contries = 38 canada,139 Micronesia,163 Palau,168 Philippines,223 & 224 United States
if(STORE_COUNTRY == 223 || STORE_COUNTRY == 224 || STORE_COUNTRY == 38 || STORE_COUNTRY == 139 || STORE_COUNTRY == 163 || STORE_COUNTRY == 168) {
$field .= tep_draw_pull_down_menu($named, $months, $month);
$field .= tep_draw_pull_down_menu($namem, $days, $day); }
else {
$field .= tep_draw_pull_down_menu($named, $days, $day);
$field .= tep_draw_pull_down_menu($namem, $months, $month); }
$field .= tep_draw_pull_down_menu($name, $years, $year);

return $field;
}

 

then in admin/customers.php

 

 

find:

 

$customers_gender = tep_db_prepare_input($HTTP_POST_VARS['customers_gender']);

 

add after:

 

$_POST['customers_dob'] = $_POST['dobd'].'/'.$_POST['dobm'].'/'.$_POST['dob'];

 

find:

 

 

<?php

if (ACCOUNT_DOB == 'true') {

?>

<tr>

<td class="main"><?php echo ENTRY_DATE_OF_BIRTH; ?></td>

<td class="main">

<?php

if ($error == true) {

if ($entry_date_of_birth_error == true) {

echo tep_draw_input_field('customers_dob', tep_date_short($cInfo->customers_dob), 'maxlength="10"') . ' ' . ENTRY_DATE_OF_BIRTH_ERROR;

} else {

echo $cInfo->customers_dob . tep_draw_hidden_field('customers_dob');

}

} else {

echo tep_draw_input_field('customers_dob', tep_date_short($cInfo->customers_dob), 'maxlength="10"', true);

}

?></td>

</tr>

<?php

}

?>

 

replace with:

 

<?php

if (ACCOUNT_DOB == 'true') {

?>

<tr>

<td class="main"><?php echo ENTRY_DATE_OF_BIRTH; ?></td>

<td class="main">

 

<?php

if ($error == true) {

if ($entry_date_of_birth_error == true) {

echo tep_draw_input_field('customers_dob', tep_date_short($cInfo->customers_dob), 'maxlength="10"') . ' ' . ENTRY_DATE_OF_BIRTH_ERROR;

} else {

echo $cInfo->customers_dob . tep_draw_hidden_field('customers_dob');

}

} else {

list($year,$month,$day) = explode("-",$cInfo->customers_dob);

$day = substr($cInfo->customers_dob, 8, 2);

echo tep_pull_down_date('dob',$day, $month, $year, '', '', 1900);

}

?></td>

</tr>

<?php

}

?>

 

I also removed the checking code:

 

 if (ACCOUNT_DOB == 'true') {
	  if (checkdate(substr(tep_date_raw($customers_dob), 4, 2), substr(tep_date_raw($customers_dob), 6, 2), substr(tep_date_raw($customers_dob), 0, 4))) {
		$entry_date_of_birth_error = false;
	  } else {
		$error = true;
		$entry_date_of_birth_error = true;
	  }
	}

 

as with this mod its un-neccessary.

 

Hope that helps.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Posted

sam thanks for the help mate,

 

i have nstalled the DOB dropdown contrib (works perfect)

 

but when i try to in stall the code you posted for the admin site i get this error...

 

Fatal error: Call to undefined function tep_pull_down_date() in /home/********/public_html/game-shop/admin/customers.php on line 448

 

line 448:

echo tep_pull_down_date('dob',$day, $month, $year, '', '', 1900);

 

is it not reading the functions in output file???

Thanks in advance!

 

Ben

Posted

When you added the function I gave, did you add it to catalog/functions/html_output.php or catalog/admin/functions/html_output.php? it should be the latter.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Posted
When you added the function I gave, did you add it to catalog/functions/html_output.php or catalog/admin/functions/html_output.php? it should be the latter.

 

 

WOOPS My Bad of course... i must of missed it....for some reason i thought it would read from the cat/functions files....

 

Thanks works perfect now...

Thanks in advance!

 

Ben

  • 4 weeks later...
Posted

I have modified this since the contrib, so the version there is not what I use on some sites.

 

If you look there is the word 'not' as default in the days field as well.

 

This is so on sites where the customer is not forced to enter a dob, in admin the words 'not set' are shown, if one has'nt been set.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

  • 1 year later...
Posted

I know this is an old topic, but I have an issue with contribution "Date of Birth PullDown" (http://addons.oscommerce.com/info/3778) and I hope Spooks (or somebody else) will be able to help me out.

 

I installed the contribution. In the frontend (create_account and account_edit) everything works fine, but in the backend I'm having some trouble when I update a user's date of birth. After hitting the submit button and checking back, the date is being reset to the default (not set 1900) and my changes got lost. It looks like they are not being injected into my db. Because I have a modified shop I tried a vanilla version of customers.php and html_output.php and made the changes from the contribution. That did not work either so my problem persists. What file could be causing my problem? I don't know where to look now.

 

Thanks for the help!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...