Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Post Code


ronan

Recommended Posts

Posted

hey,

 

I need the post code option to be optinal when setting up an new account. I have set the minimum value for post code to '0' but if someone leaves the field blank it comes up with an error saying that the post code has to be at least '0' characters long. How do i set it so that you dont have to put in anything?

 

Cheers

Posted
hey,

 

I need the post code option to be optinal when setting up an new account. I have set the minimum value for post code to '0' but if someone leaves the field blank it comes up with an error saying that the post code has to be at least '0' characters long. How do i set it so that you dont have to put in anything?

 

Cheers

 

Not sure if this will work but if you look at english.php in the includes/languages directory, you'll find the following lines:

 

define('ENTRY_SUBURB', 'Suburb:');

define('ENTRY_SUBURB_ERROR', '');

define('ENTRY_SUBURB_TEXT', '');

define('ENTRY_POST_CODE', 'Post Code:');

define('ENTRY_POST_CODE_ERROR', 'Your Post Code must contain a minimum of ' . ENTRY_POSTCODE_MIN_LENGTH . ' characters.');

define('ENTRY_POST_CODE_TEXT', '*');

 

See what happens if you change define('ENTRY_POST_CODE_ERROR', 'Your Post Code ...

to

define('ENTRY_POSTCODE_ERROR', '');

 

I'm guessing that the presence of the error string makes the postcode mandatory whereas the Suburb would be optional as the error string is empty.

 

Worth a try anyway.

 

Andy

Posted

As far as i know that will only remove the text that will appear when it see's that their is no postal code entered but it will still stop at that point with the error anway.

Posted
As far as i know that will only remove the text that will appear when it see's that their is no postal code entered but it will still stop at that point with the error anway.

 

OK, try commenting out the following lines from create_account.php

 

if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) {

$error = true;

 

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

}

 

 

 

I'd have thought that strlen($postcode) would be returning 0 and so you shouldn't get the error but obviously you are so removing the above lines should work. Or try setting the minimum length of the postcode to -1.

Posted

open create_account.php and look for this:

if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) {
  $error = true;

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

 

Either remove it completely, or comment it out. That should do the trick.

Posted
open create_account.php and look for this:

if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) {
  $error = true;

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

 

Either remove it completely, or comment it out. That should do the trick.

 

and comment out this line in catalog\includes\form_check.js.php

 check_input("postcode", <?php echo ENTRY_POSTCODE_MIN_LENGTH; ?>, "<?php echo ENTRY_POST_CODE_ERROR; ?>");

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Archived

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

×
×
  • Create New...