I wonder if anyone can see what's wrong with this code?
I've been trying to modify the Date of Birth (Drop Down DOB) mod to use on our sign up page. However, I don't want it to record the customers date of birth, I want it to record their wedding date.
I'm getting there with it but I've had to disable it for now as there's a coding error that prevents customers registering.
I've got it installed and everything but since it's a DOB mod the dates were in the drop down menu from today, going backwards in time. I traced this to a line in /includes/functions/extra_functions/functions_dob.php:
Changing the line to this corrects the date sequence:PHP Code:
$today = getdate();
$first_year = 1901;
$last_year = $today['year'];
PHP Code:
$today = getdate();
$first_year = $today['year'];
$last_year = 2050;
It looks right now but it doesn't function right as it prevents the registration. Obviously something in the code is telling it to expect a DOB so future date's are causing it some sort of logic problem. Can anyone see what else I'd need to change so that it looks for future dates instead of past dates?:
PHP Code:
<?php
//
// +----------------------------------------------------------------------+
// | Pull Down DOB menu for zen-cart 1.3x Open Source E-commerce |
// +----------------------------------------------------------------------+
// | Copyright (c) 2006 Jeff Dripps (Interactive Sports Entertainment) |
// | [email protected] |
// | |
// | |
// | |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license, |
// | that is bundled with this package in the file LICENSE.txt, and is |
// | available through the world-wide-web at the following url: |
// | http://www.gnu.org/licenses/gpl.txt |
// +----------------------------------------------------------------------+
// $Id: functions_dob.php,v 0.1 2006/04/27 15:46:12 JTD
function zen_draw_pull_down_dob_menu($dob_raw) {
$dob_day = array();
$dob_month = array();
$dob_year = array();
$dob_day[] = array('id' => sprintf('%02d', 0), 'text' => 'day');
$dob_month[] = array('id' => sprintf('%02d', 0), 'text' => 'month');
$dob_year[] = array('id' => sprintf('%02d', 0), 'text' => 'year');
for ($i=1; $i<32; $i++) {
$dob_day[] = array('id' => sprintf('%02d', $i), 'text' => sprintf('%02d', $i));
}
for ($i=1; $i<13; $i++) {
$dob_month[] = array('id' => sprintf('%02d', $i), 'text' => strftime('%B',mktime(0,0,0,$i,1,2000)));
}
$today = getdate();
$first_year = $today['year'];
$last_year = 2100;
for ($i=$first_year; $i <= $last_year; $i++) {
$dob_year[] = array('id' => sprintf('%02d', $i), 'text' => sprintf('%02d', $i));
}
if (!isset($dob_raw)) {
$dob_year_val = 0;
$dob_month_val = 0;
$dob_day_val = 0;
}
else {
$dob_year_val = (int)substr(zen_date_raw($dob_raw), 0, 4);
$dob_month_val = (int)substr(zen_date_raw($dob_raw), 4, 2);
$dob_day_val = (int)substr(zen_date_raw($dob_raw), 6, 2);
}
if (DOB_FORMAT_STRING == 'mm/dd/yyyy') {
echo zen_draw_pull_down_menu('dob_month', $dob_month, $dob_month_val, 'id="dob_month"');
echo zen_draw_pull_down_menu('dob_day', $dob_day, $dob_day_val, 'id="dob_day"');
}
else {
echo zen_draw_pull_down_menu('dob_day', $dob_day, $dob_day_val, 'id="dob_day"');
echo zen_draw_pull_down_menu('dob_month', $dob_month, $dob_month_val, 'id="dob_month"');
}
echo zen_draw_pull_down_menu('dob_year', $dob_year, $dob_year_val, 'id="dob_year"');
}
?>
Bookmarks