Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Looking for Help Converting the Date of Birth mod to a Wedding Date Mon on Sign Up

    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:
    PHP Code:
    $today getdate();
    $first_year 1901;
    $last_year $today['year']; 
    Changing the line to this corrects the date sequence:
    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), 04);
        
    $dob_month_val = (int)substr(zen_date_raw($dob_raw), 42);
        
    $dob_day_val = (int)substr(zen_date_raw($dob_raw), 62);
    }

    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"');
    }
    ?>

  2. #2
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: Looking for Help Converting the Date of Birth mod to a Wedding Date Mon on Sign U

    Looking at this line in the above file:

    PHP Code:
    for ($i=$first_year$i <= $last_year$i++) {
    $dob_year[] = array('id' => sprintf('%02d'$i), 'text' => sprintf('%02d'$i));

    Can't seem to figure out how to tell it that the date should be a future date. I've tried this:

    PHP Code:
    for ($i=$last_year$i <= $first_year$i++) {
    $dob_year[] = array('id' => sprintf('%02d'$i), 'text' => sprintf('%02d'$i));

    Swapping $last with $first just makes the date drop down blank. Can anyone see what syntax I need to change here? I've tried several hit & miss changes but they either make the year drop down blank, or make the whole site white page

  3. #3
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: Looking for Help Converting the Date of Birth mod to a Wedding Date Mon on Sign U

    Never mind, I've figured this out. It was actually a missing line in another file. It's working now as I want it. Onto the next part of the puzzle now, how to add this new "wedding date" to all new order confirmation emails and how to add it to the customer panel at the right hand side of the screen in /admin/customers.php?page=1&cID=XXXX

 

 

Similar Threads

  1. Replies: 3
    Last Post: 21 Jun 2010, 02:46 PM
  2. Issue w/ Customer Account Create DOB / Date of Birth Pulldown Mod
    By Donn in forum All Other Contributions/Addons
    Replies: 5
    Last Post: 18 Feb 2009, 10:33 PM
  3. Changing the date of birth input
    By Orchard_Direct in forum Basic Configuration
    Replies: 0
    Last Post: 26 Nov 2007, 09:16 PM
  4. Registration & Birth date - problem with the format
    By sanji in forum General Questions
    Replies: 1
    Last Post: 7 Nov 2007, 05:16 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR