Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

disabling date of birth field


mikeuk

Recommended Posts

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)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 6 months later...

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.

Link to comment
Share on other sites

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 *

Link to comment
Share on other sites

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;

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...