Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

disabling date of birth field


mikeuk

Recommended Posts

Posted

It's an option in the amin module: configuration -> my store -> customer details

Local: Mac OS X 10.5.8 - Apache 2.2/php 5.3.0/MySQL 5.4.10 • Web Servers: Linux

Tools: BBEdit, Coda, Versions (Subversion), Sequel Pro (db management)

Posted

brill.

 

just what i needed but what about still having the option to let customers enter in their DOB but not as compulsary??

 

I see that by going to the admin module and setting the DOB to false, it physically removes the DOB text box altogether.

Posted

Call me crazy but...I can't find this Customer Info option on my Admn panel?

Posted

Yes I'm having the same problem. How to set the gender and DOB field optional?

The admin just toggles them on and off.

Posted

In catalog>create_account.php try commenting out the following code:

 

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

       $messageStack->add('create_account', ENTRY_DATE_OF_BIRTH_ERROR);
     }
   }

 

Then you will want to change this:

 

<?php
 if (ACCOUNT_DOB == 'true') {
?>
             <tr>
               <td class="main"><?php echo ENTRY_DATE_OF_BIRTH; ?></td>
               <td class="main"><?php echo tep_draw_input_field('dob') . ' ' . (tep_not_null(ENTRY_DATE_OF_BIRTH_TEXT) ? '<span class="inputRequirement">' . ENTRY_DATE_OF_BIRTH_TEXT . '</span>': ''); ?></td>
             </tr>
<?php
 }
?>

 

to this:

<?php
 if (ACCOUNT_DOB == 'true') {
?>
             <tr>
               <td class="main"><?php echo ENTRY_DATE_OF_BIRTH; ?></td>
               <td class="main"><?php echo tep_draw_input_field('dob')?></td>
             </tr>
<?php
 }
?>

 

Hope this helps!

Posted

Thanks!

 

Found that also need to change include/form_check.js.php

 

<?php if (ACCOUNT_DOB == 'true') echo '  check_input("dob", ' . 
ENTRY_DOB_MIN_LENGTH . ', "' . ENTRY_DATE_OF_BIRTH_ERROR . '");' . "\n"; ?>

Posted

This hack is getting more complicated than I thought.

 

Commenting out as suggested turns off the checking totally.

I would like to have input checking if something is entered, if it is blank, just leave it optional.

:unsure:

 

any ideas?

Posted

you could put an if statement round the error checking statement i think

not 100% on exactly how oscommerce works with regard to checking (the javascript is something i havent messed with) but the basic premise of my solution should still work even if you have to tweak it a bit

 

eg

(in english)

 

-----

 

if (dob_variable_not_empty) {

run error check

}

 

-----

 

(in php)

 

-----

 

if ($dob != "") {

 

echo ' check_input("dob", ' .

ENTRY_DOB_MIN_LENGTH . ', "' . ENTRY_DATE_OF_BIRTH_ERROR . '");' . "\n";

 

}

 

-----

 

please note

you will need to replace $dob with whatever variable oscommerce uses to store the data that gets passed when the form field dob is sent - it will be buried within the code somewhere :( if anyone knows this variable then please post it here

always here to offer some useless advice....

  • 6 months later...
Posted

Has anyone found the solution to this issue?

I've searched and searched..

 

I need the field, but need it to be optional not required

for the customer.

Posted

Go to INCLUDES/LANGUAGES/ENGLISH.PHP

and remove from these fields mark to be required

define('ENTRY_GENDER_TEXT', '*');

define('ENTRY_DATE_OF_BIRTH_TEXT', '* (eg. 05/21/1970)');

 

 

just remove *

Posted

What will happen if in this line

 

if (ACCOUNT_DOB == 'true') {

if (checkdate(substr(tep_date_raw($dob), 4, 2), substr(tep_date_raw($dob), 6, 2), substr(tep_date_raw($dob), 0, 4)) == false) {

$error = true;

 

$messageStack->add('create_account', ENTRY_DATE_OF_BIRTH_ERROR);

}

}

 

 

you will set $error = false;

Posted

Easy way to do this is to take for DOB field are already optional

(like FAX NUMBER) , if you have fields not in use

:D :D :blink:

Archived

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

×
×
  • Create New...