Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Making required fields not required


BlasphemousMusic

Recommended Posts

All I need to do, which I cannot figure out, is to take the red * off the fields and also make some of the fields optional and not required. I have searched for hours on end for solutions to this and the only one I have found so far said to edit the customer details. But the fields have all ready been set to false and will not update correctly. I am selling items which do not require any shipping, and adress will be located in paypal, so please please for the love of... someone direct me to the right place or tell me which line of code to edit. I have been in create_account.php and the only thing I was able to do was completely take it off the registration of a new account. I don't want that I just want them like I said to be optional and still be able to create an account with or without these fields. I thank you greatly in advance!!!!

 

-jim

Link to comment
Share on other sites

Okay, in create_account.php, you'll see text that looks like this for those fields that are marked as required -- in this example, the 'City' field:

 

<?php echo tep_draw_input_field('city', '', 'size="30"') . ' ' . (tep_not_null(ENTRY_CITY_TEXT) ? '<span class="inputRequirement">' . ENTRY_CITY_TEXT . '</span>': ''); ?>

 

This part of that code:

 

<span class="inputRequirement">' . ENTRY_CITY_TEXT . '</span>

 

tells the script to look at this code in /catalog/includes/languages/english.php for the corresponding text. In that file, you'll find:

 

define('ENTRY_CITY_TEXT', '*');

 

Changing that code (obviously with all of the fields that you don't want flagged as required -- not just the 'City' example I'm giving) to:

 

define('ENTRY_CITY_TEXT', ' ');

 

should remove the 'required' reference from your pages.

 

HTH,

 

Terry

Terry Kluytmans

 

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

* If at first you don't succeed, find out if there's a prize for the loser. *

Link to comment
Share on other sites

  • 1 month later...
Okay, in create_account.php, you'll see text that looks like this for those fields that are marked as required -- in this example, the 'City' field:

 

<?php echo tep_draw_input_field('city', '', 'size="30"') . ' ' . (tep_not_null(ENTRY_CITY_TEXT) ? '<span class="inputRequirement">' . ENTRY_CITY_TEXT . '</span>': ''); ?>

 

This part of that code:

 

<span class="inputRequirement">' . ENTRY_CITY_TEXT . '</span>

 

tells the script to look at this code in /catalog/includes/languages/english.php for the corresponding text. In that file, you'll find:

 

define('ENTRY_CITY_TEXT', '*');

 

Changing that code (obviously with all of the fields that you don't want flagged as required -- not just the 'City' example I'm giving) to:

 

define('ENTRY_CITY_TEXT', ' ');

 

should remove the 'required' reference from your pages.

 

HTH,

 

Terry

Okay,

I tried it your way and had success in removing the red stars.

 

But nevertheless, a popup-Window appears.

It insists that the fields must have a certain length, even one of 0!?

 

Any idea to work around that problem?

 

Thanks

Link to comment
Share on other sites

Removing the * from this script only removes the red mark from the laccount creation form.

 

It doesn't tell the script no to require it...

 

Here is the script;

 

define('ENTRY_CITY_TEXT', '*');

 

Any idea on how to make the telephone number not required ?

Link to comment
Share on other sites

in the database in table customers you need to edit the fields you want to not be required and set null to NO.....That will fix the required information...

 

 

 

 

 

 

 

Mike

Link to comment
Share on other sites

You access the customer table via telnet or something like 'mysql front'.

You find your table (customers) and modify the columns that you want to change to be not null.

 

i wouldn't advise messing with this unless you know what you are doing though as it can damage your oscommerce system.

 

i just commented out the gender line so they cant enter a gender. that solves the prob!

always here to offer some useless advice....

Link to comment
Share on other sites

When I wanted to make a field that was required optional, I removed the " * " using the process above, and I just removed the validation function.

 

if (strlen($firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) {
     $error = true;

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

 

This did it for me and it was pretty easy.

 

By the way, you also have to change account_edit.php the same way. Otherwise, if somebody tries to edit their account settings, they will then be required to submit all the information that you originally made optional.

Link to comment
Share on other sites

  • 2 weeks later...
in the database in table customers you need to edit the fields you want to not be required and set null to NO.....That will fix the required information...

 

Mike

I'm banging my head against the wall on this one myself

 

I haven't messed with the database, but taking a peek show me that all fields in table "customers" under NULL are set to NO with the exception of

 

customers_fax

customers_newsletter

 

which are set to YES.

 

i just commented out the gender line so they cant enter a gender. that solves the prob!

 

I did that too... so now I have no "gender" field on the form, but it still tells me it's required!

 

Any other ideas?

Link to comment
Share on other sites

That didn't fix it either. :(

 

I should note, I'm specifically trying to remove the gender field, and to make date of birth optional.

 

I removed gender from the form, but it is still trying to validate it. I removed the * from DOB, and it is still trying to validate it.

 

I understand the * doesn't cause the validation, I'm just trying to be thorough in explaining my issue.

Link to comment
Share on other sites

Once you have set the NULL field to YES for the date of birth, then set the minimum value in the Admin for date of birth to blank in Admin/Configuration/Minimum Values. That should make it optional.

 

If it still does not work, you might just want to remove it completely by going to Admin/Configuration/Customer Details

I'd rather be flying!

Link to comment
Share on other sites

If it still does not work, you might just want to remove it completely by going to Admin/Configuration/Customer Details

DUH!

 

I think that was what I was looking for all along! Thanks a bunch!

Link to comment
Share on other sites

  • 2 weeks later...

Help!!!

 

I followed the steps to remove the required field for the phone number and it worked.

 

However, IE 6 has been generating a syntax error message for line 116, character 28 in catalog/create_account.php.

 

So, I reinstalled the ORIGINAL files for catalog/create_account.php and it still shows the error message.

 

Then I reinstalled the original file for catalog/languages/english/create_account.php and it STILL shows the error message AND the missing asterisk after the phone number (which I removed).

 

 

Create Account page

 

Help! What am I missing????

Link to comment
Share on other sites

Sorry, Folks, but some of these things don't really work. Or they do, but they can generate errors in IE.

 

For example, you can't set the minimum field to 0 or a non-0 number without generating some type of error.

 

The best thing to do is to delete the Minimum requirement altogether by deleting all instances of the field from the database and PHP scripts.

 

There are references to the phone field and most other fields on 11 different pages! Or 7 pages if you only use english.

 

- account_edit.php - catalog

- create_account.php - catalog

- oscommerce.sql - catalog/install

- form_check.js.php - catalog/includes

- english.php - catalog/languages

- espanol ..

- german ...

- customers.php - catalog/admin

- english.php - catalog/admin/includes/languages

- espanol ..

- german ..

 

I am going to create a little helpful manual as I go along and will put the link to the guide in my signature file for easy reference.

Link to comment
Share on other sites

  • 4 years later...
  • 3 years later...

@@Ninety-one Maro 3 means its still required, set to 0 for not required

 

The security add-on I did checks a phone number if given, then that it passes set params, if not provided ignored.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

@@spooks

 

Ok, I have it set to 0. I have also "//" the lines in the code that requires the phone number and fax number. I have also removed the * from the phone number stating that it is required.

 

I have installed an add on, Social Login, using LoginRadius. Every time someone tries to create an account, using their Facebook account, it gives them an error stating phone number required. That error is on my server side, not the Facebook side, as it is trying to pull a phone number from Facebook, even though I have it setup as not required. I have gone step by step through this procedure here, and still can't get it to work. Kliksys has been assisting me on trying this out.

 

Now, if a customer has an account at my site, and then comes back and wants to sign on with their Facebook instead so they don't have to remember passwords and such, then it works perfect. But only after they first create an account and put in a phone number.

 

Don't make sense.

Link to comment
Share on other sites

That sounds like a problem with the Social Login add-on, have you tried posting in its support thread?

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

My advise has always been, if a contribution is not properly supported, don't use it.

 

I also feel expecting users to go elsewhere for support & just using this forum as a repository is un-ethical.

 

Have you checked that passing your customers data through a third party is legal in your region?

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...