Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Edit the **Required Fields in create_account?


verbalkent

Recommended Posts

Me again, Is there a way to edit which fields on the create_account page are listed as required?? I do not want to remove the fields, I want to make them optional instead of **Required.. such as Gender and DOB, I find that these fields should be optional and not required. how can I go about editing which fields are RequireD??

 

thx

Link to comment
Share on other sites

the knowledge base shows lots of this, in the admin area under customer details

 

 

 

Yes that is the same answer you gave on my previous post. There is no info on changing the **Required information on the create_account file... (This is the document that I am viewing http://www.oscommerce.info/kb/osCommerce/A...unt_Details/159 )

 

That only allows me to Completly Remove a field, and it gives that option to only a few of the fields in the create_account page, (what if I wanted to edit the Zip Code and Firstname Fields??) that is not what I want, I want to edit which fields are REQUIRED, and Which are OPTIONAL...

 

I have downloaded a contribution that says it does this, but I dont think it matches the current build that I am using (Not at my workstation now to give full details)

 

 

 

Any help would be appreciated

Link to comment
Share on other sites

then you must be using something not from here. where did you download osCommerce from? under configuration is a link to customer details.

 

can you provide a link to your site?

 

also, if you didnt get the answer you want to hear, do not create another thread, continue posting in the same thread so others can see what has been posted.

Link to comment
Share on other sites

then you must be using something not from here.  where did you download osCommerce from?  under configuration is a link to customer details.

 

can you provide a link to your site?

 

also, if you didnt get the answer you want to hear, do not create another thread, continue posting in the same thread so others can see what has been posted.

Link to comment
Share on other sites

then you must be using something not from here.  where did you download osCommerce from?  under configuration is a link to customer details.

 

can you provide a link to your site?

 

also, if you didnt get the answer you want to hear, do not create another thread, continue posting in the same thread so others can see what has been posted.

 

 

 

http://www.hunidproof.com/ <-- is my site

I downloaded the package from http://www.oscommerce.com/redirect.php/go,17

 

 

Yes I see the link for customer details, but it is not offering the options I need, as stated in the initial post.. I dont know if I am making my problem clear enough, if not please let me know.

Link to comment
Share on other sites

i have double checked many sites, they all have the option of true or false. are you wanting to display birthdate and gender and make it optional?

Link to comment
Share on other sites

i have double checked many sites, they all have the option of true or false.  are you wanting to display birthdate and gender and make it optional?

 

 

 

 

Yes I do, I want to display the Gender, Birthday, and other fields, But not have them as a **Required field, .. giving the customer the choice to input the information without bieng forced to type in the information.

Link to comment
Share on other sites

BACKUP your files first!!!

 

In your Admin->Configuration->Minimum Values, set the field that you don't want required to "0"

 

In catalog/includes/form_check.js.php (about line 95), you will find

function check_form(form_name)

 

and below that a few lines, you will find a separate line for each of the fields that is being checked as required. Since I'm not sure how to comment out the particular format in which these are presented, I just removed the entire line for the field that I was testing (post code in this test case):

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

 

I then set up a test account with no entry in the Post Code field and it proceeded just fine.

 

P.S. - Then you will need to go into your language file for create_account and get rid of the asterisk that is in the text define for the item(s) you have made not required.

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Link to comment
Share on other sites

BACKUP your files first!!!

 

In your Admin->Configuration->Minimum Values, set the field that you don't want required to "0"

 

In catalog/includes/form_check.js.php (about line 95), you will find

function check_form(form_name)

 

and below that a few lines, you will find a separate line for each of the fields that is being checked as required. Since I'm not sure how to comment out the particular format in which these are presented, I just removed the entire line for the field that I was testing (post code in this test case):

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

 

I then set up a test account with no entry in the Post Code field and it proceeded just fine.

 

P.S. - Then you will need to go into your language file for create_account and get rid of the asterisk that is in the text define for the item(s) you have made not required.

 

 

 

 

Worked Great, To help others, I also edited these files to get rid of the "*" symbol next to the old required fields...

 

in catalog/includes/languages/english.php

look for..

define('ENTRY_GENDER', 'Gender:');

define('ENTRY_GENDER_ERROR', 'Please select your Gender.');

define('ENTRY_GENDER_TEXT', '*');

define('ENTRY_FIRST_NAME', 'First Name:');

define('ENTRY_FIRST_NAME_ERROR', 'Your First Name must contain a minimum of ' . ENTRY_FIRST_NAME_MIN_LENGTH . ' characters.');

define('ENTRY_FIRST_NAME_TEXT', '*');

define('ENTRY_LAST_NAME', 'Last Name:');

define('ENTRY_LAST_NAME_ERROR', 'Your Last Name must contain a minimum of ' . ENTRY_LAST_NAME_MIN_LENGTH . ' characters.');

define('ENTRY_LAST_NAME_TEXT', '*');

 

and so on... then remove the "*" where it defines the ENTRY_*.*_TEXT,

for example, to remove the * displayed at the Genders field simply edit

define('ENTRY_GENDER_TEXT', '*');

to look like

define('ENTRY_GENDER_TEXT', '');

 

 

and so on with the other fields you want to remove the * symbol from..

 

 

also,... here is my catalog/includes/form_check.js.php

 

 

<?php

// ******************************************************************

//

// ******************************************************************

if ((ACCOUNT_FIRSTNAME == 'true') && (ACCOUNT_REQUIRED_FIRSTNAME == 'true')) echo ' var first_name = document.account_edit.firstname.value;' . "\n";

if ((ACCOUNT_LASTNAME == 'true') && (ACCOUNT_REQUIRED_LASTNAME == 'true')) echo ' var last_name = document.account_edit.lastname.value;' . "\n";

if ((ACCOUNT_DOB == 'true') && (ACCOUNT_REQUIRED_DOB == 'false')) echo ' var dob = document.account_edit.dob.value;' . "\n";

if ((ACCOUNT_EMAIL == 'true') && (ACCOUNT_REQUIRED_EMAIL == 'true')) echo ' var email_address = document.account_edit.email_address.value; ' . "\n";

 

if ((ACCOUNT_COMPANY == 'true') && (ACCOUNT_REQUIRED_COMPANY == 'false')) echo ' var company = document.account_edit.company.value;' . "\n";

 

if ((ACCOUNT_ADDRESS == 'true') && (ACCOUNT_REQUIRED_ADDRESS == 'false')) echo ' var street_address = document.account_edit.street_address.value;' . "\n";

if ((ACCOUNT_ZIPCODE == 'true') && (ACCOUNT_REQUIRED_ZIPCODE == 'false')) echo ' var postcode = document.account_edit.postcode.value;' . "\n";

if ((ACCOUNT_CITY == 'true') && (ACCOUNT_REQUIRED_CITY == 'false')) echo ' var city = document.account_edit.city.value;' . "\n";

 

if ((ACCOUNT_PHONE == 'true') && (ACCOUNT_REQUIRED_PHONE == 'false')) echo ' var telephone = document.account_edit.telephone.value;' . "\n";

if ((ACCOUNT_FAX == 'true') && (ACCOUNT_REQUIRED_FAX == 'false')) echo ' var fax = document.account_edit.fax.value;' . "\n";

?>

 

var password = document.account_edit.password.value;

var confirmation = document.account_edit.confirmation.value;

 

<?php

// ******************************************************************

//

// ******************************************************************

if ((ACCOUNT_GENDER == 'true') && (ACCOUNT_REQUIRED_GENDER == 'false')) {

?>

if (document.account_edit.elements['gender'].type != "hidden") {

if (document.account_edit.gender[0].checked || document.account_edit.gender[1].checked) {

} else {

error_message = error_message + "<?php echo JS_GENDER; ?>";

error = 1;

}

}

<?php

}

// ******************************************************************

//

// ******************************************************************

if ((ACCOUNT_FIRSTNAME == 'true') && (ACCOUNT_REQUIRED_FIRSTNAME == 'true')){

?>

if (document.account_edit.elements['firstname'].type != "hidden") {

if (first_name == '' || first_name.length < <?php echo ENTRY_FIRST_NAME_MIN_LENGTH; ?>) {

error_message = error_message + "<?php echo JS_FIRST_NAME; ?>";

error = 1;

}

}

 

<?php

}

// ******************************************************************

//

// ******************************************************************

if ((ACCOUNT_LASTNAME == 'true') && (ACCOUNT_REQUIRED_LASTNAME == 'true')) {

?>

if (document.account_edit.elements['lastname'].type != "hidden") {

if (last_name == '' || last_name.length < <?php echo ENTRY_LAST_NAME_MIN_LENGTH; ?>) {

error_message = error_message + "<?php echo JS_LAST_NAME; ?>";

error = 1;

}

}

 

<?php

}

// ******************************************************************

//

// ******************************************************************

if ((ACCOUNT_DOB == 'true') && (ACCOUNT_REQUIRED_DOB == 'false')) {

?>

if (document.account_edit.elements['dob'].type != "hidden") {

if (dob == '' || dob.length < <?php echo ENTRY_DOB_MIN_LENGTH; ?>) {

error_message = error_message + "<?php echo JS_DOB; ?>";

error = 1;

}

}

<?php

}

// ******************************************************************

//

// ******************************************************************

if ((ACCOUNT_EMAIL == 'true') && (ACCOUNT_REQUIRED_EMAIL == 'true')) {

?>

if (document.account_edit.elements['email_address'].type != "hidden") {

if (email_address == '' || email_address.length < <?php echo ENTRY_EMAIL_ADDRESS_MIN_LENGTH; ?>) {

error_message = error_message + "<?php echo JS_EMAIL_ADDRESS; ?>";

error = 1;

}

}

<?php

}

// ******************************************************************

//

// ******************************************************************

if ((ACCOUNT_COMPANY == 'true') && (ACCOUNT_REQUIRED_COMPANY == 'false')) {

?>

 

if (document.account_edit.elements['company'].type != "hidden") {

if (company == '' || company.length < <?php echo ENTRY_COMPANY_LENGTH; ?>) {

error_message = error_message + "<?php echo JS_COMPANY; ?>";

error = 1;

}

}

<?php

}

// ******************************************************************

//

// ******************************************************************

if ((ACCOUNT_ADDRESS == 'true') && (ACCOUNT_REQUIRED_ADDRESS == 'false')) {

?>

if (document.account_edit.elements['street_address'].type != "hidden") {

if (street_address == '' || street_address.length < <?php echo ENTRY_STREET_ADDRESS_MIN_LENGTH; ?>) {

error_message = error_message + "<?php echo JS_ADDRESS; ?>";

error = 1;

}

}

<?php

}

// ******************************************************************

//

// ******************************************************************

if ((ACCOUNT_ZIPCODE == 'true') && (ACCOUNT_REQUIRED_ZIPCODE == 'false')) {

?>

if (document.account_edit.elements['postcode'].type != "hidden") {

if (postcode == '' || postcode.length < <?php echo ENTRY_POSTCODE_MIN_LENGTH; ?>) {

error_message = error_message + "<?php echo JS_POST_CODE; ?>";

error = 1;

}

}

<?php

}

// ******************************************************************

//

// ******************************************************************

if ((ACCOUNT_CITY == 'true') && (ACCOUNT_REQUIRED_CITY == 'false')) {

?>

if (document.account_edit.elements['city'].type != "hidden") {

if (city == '' || city.length < <?php echo ENTRY_CITY_MIN_LENGTH; ?>) {

error_message = error_message + "<?php echo JS_CITY; ?>";

error = 1;

}

}

 

<?php

}

// ******************************************************************

//

// ******************************************************************

if ((ACCOUNT_COUNTRY == 'true') && (ACCOUNT_REQUIRED_COUNTRY == 'true')) {

?>

if (document.account_edit.elements['country'].type != "hidden") {

if (document.account_edit.country.value == 0) {

error_message = error_message + "<?php echo JS_COUNTRY; ?>";

error = 1;

}

}

 

<?php

}

// ******************************************************************

//

// ******************************************************************

if ((ACCOUNT_STATE == 'true') && (ACCOUNT_REQUIRED_STATE == 'true')) {

?>

if (document.account_edit.elements['zone_id'].type != "hidden") {

if (document.account_edit.zone_id.options.length <= 1) {

if (document.account_edit.state.value == '' || document.account_edit.state.value.length < <?php echo ENTRY_STATE_MIN_LENGTH; ?> ) {

error_message = error_message + "<?php echo JS_STATE; ?>";

error = 1;

}

} else {

document.account_edit.state.value = '';

if (document.account_edit.zone_id.selectedIndex == 0) {

error_message = error_message + "<?php echo JS_ZONE; ?>";

error = 1;

}

}

}

<?php

}

// ******************************************************************

//

// ******************************************************************

if ((ACCOUNT_PHONE == 'true') && (ACCOUNT_REQUIRED_PHONE == 'true')) {

?>

if (document.account_edit.elements['telephone'].type != "hidden") {

if (telephone == '' || telephone.length < <?php echo ENTRY_TELEPHONE_MIN_LENGTH; ?>) {

error_message = error_message + "<?php echo JS_TELEPHONE; ?>";

error = 1;

}

}

<?php

}

// ******************************************************************

//

// ******************************************************************

if ((ACCOUNT_FAX == 'true') && (ACCOUNT_REQUIRED_FAX == 'true')) {

?>

if (document.account_edit.elements['fax'].type != "hidden") {

if (fax == '' || fax.length < <?php echo ENTRY_FAX_MIN_LENGTH; ?>) {

error_message = error_message + "<?php echo JS_FAX; ?>";

error = 1;

}

}

<?php

}

// ******************************************************************

//

// ******************************************************************

?>

 

if (document.account_edit.elements['password'].type != "hidden") {

if ((password != confirmation) || (password == '' || password.length < <?php echo ENTRY_PASSWORD_MIN_LENGTH; ?>)) {

error_message = error_message + "<?php echo JS_PASSWORD; ?>";

error = 1;

}

}

 

if (error == 1) {

alert(error_message);

return false;

} else {

return true;

}

}

//--></script>

 

 

 

I took your advice and found that simply adding "false" to every occurance of the field you want to be optional works... For example =

 

 

if ((ACCOUNT_CITY == 'true') && (ACCOUNT_REQUIRED_CITY == 'false')) echo ' var city = document.account_edit.city.value;' . "\n";

 

if ((ACCOUNT_PHONE == 'true') && (ACCOUNT_REQUIRED_PHONE == 'false')) echo ' var telephone = document.account_edit.telephone.value;' . "\n";

if ((ACCOUNT_FAX == 'true') && (ACCOUNT_REQUIRED_FAX == 'false'))

 

 

 

 

Hope this helps others with ms2 and in the same perdicament..

verified on ms2

 

 

thnx all.... I think Im getting the hang of it,

Link to comment
Share on other sites

  • 3 weeks later...

you need to be careful doing this kind of edit...for example, the customers table is set up to not allow NULL for the telephone number...so a customer trying to create an account without a phone number may get a database error...or the zip cofe...the shipping modules will not work correctly without one...be careful or you will end up with a can of worms...

Link to comment
Share on other sites

  • 2 weeks later...
That does not help with DOB and Gender.. does anyone know how to do those?

 

For gender....

 

admin/includes/form_check.js

 

remove the following from around line 105:

 

<?php if (ACCOUNT_GENDER == 'true') echo '  check_radio("gender", "' . ENTRY_GENDER_ERROR . '");' . "\n"; ?>

 

create_account.php

 

remove the following:

 

    if (ACCOUNT_GENDER == 'true') {
     if ( ($gender != 'm') && ($gender != 'f') ) {
       $error = true;

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

 

 

This should work.

 

Rob

Link to comment
Share on other sites

  • 1 year later...

The last post works, but you also need to change the catalog/account_edit.php file because if the customer tries to edit their existing account, again gender is required...

 

back up ur old file first...

 

open catalog/account_edit.php --

 

around line 24 comment out this line like this:

//if (ACCOUNT_GENDER == 'true') $gender = tep_db_prepare_input($HTTP_POST_VARS['gender']);

 

around lines 34-40 comment out these lines like this:

/* if (ACCOUNT_GENDER == 'true') {

if ( ($gender != 'm') && ($gender != 'f') ) {

$error = true;

 

$messageStack->add('account_edit', ENTRY_GENDER_ERROR);

}

}*/

 

around lines 184-190 comment out these lines like this so no gender isnt automatically selected:

 

<?php

if (ACCOUNT_GENDER == 'true') {

/*if (isset($gender)) {

$male = ($gender == 'm') ? true : false;

} else {

$male = ($account['customers_gender'] == 'm') ? true : false;

}

$female = !$male;*/

?>

Link to comment
Share on other sites

  • 9 months later...

Can anyone tell me how to edit the ff: (found in the create_account / registration page)

 

1. Page heading - My Account Information

2. The sub-heading - NOTE:If you already have an account with us, please login at the login page.

 

I looked around in the forum and I couldn't find a thread pointing to this. I checked out the file as well and coudn't find #2.

 

I need to edit the sentence and font details.

 

Thanks.

Link to comment
Share on other sites

  • 1 month later...

For anyone still working with this...

 

I've added a contibution to handle this stuff...

It's called "Required Customer Details" and you can find it here:

http://www.oscommerce.com/community/contributions,5407

 

Hope someone is helped...

Like Eek said... It never hurts to help!
----------------------------------------

Link to comment
Share on other sites

  • 1 month later...

FIXED....... if you view my account create page at Create Account youll see i moved some of the fields around. MAKE SURE all your php { and } are starting and ending in the right places I had some extras and missing ones i had to do myself

<?php
 }
 if (XXXXXXXXXXXXXX!= 'false') {
?>
  <tr>
	 <td></td>
  </tr>
<?php
 }
?>

Link to comment
Share on other sites

  • 3 years later...

I gotta say, well-done! I've installed this on OSC 2.3.1 with a heavily-modified site, and this really helps!

 

I'm so glad I ran across this thread and contribution... I just wondered if there were any updates to this with any more whistles...

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...