Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Membership form issue


hkgenesis

Recommended Posts

Depending on the field, you may be able to make it compulsory in the Admin area.  If not there, you make it compulsory in the page that processes the form. 

Here's the code that makes the email compulsory in create_account.php (from 2.3.3.4 but likely the same in all 2.3.x): 

    if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
      $error = true;

      $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR);
    } elseif (tep_validate_email($email_address) == false) {
      $error = true;

      $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
    } else {
      $check_email_query = tep_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
      $check_email = tep_db_fetch_array($check_email_query);
      if ($check_email['total'] > 0) {
        $error = true;

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

Note that the ENTRY_EMAIL_ADDRESS_MIN_LENGTH is something that is set in the Admin. 

To make something that is currently compulsory so that it is optional, you'd have to make code like this not run.  Note that it would be a very bad idea to make the email address not compulsory. 

It's also marked as required by translated text: 

 . (tep_not_null(ENTRY_EMAIL_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_TEXT . '</span>': ''); 

And from the language file, english.php :

define('ENTRY_EMAIL_ADDRESS_TEXT', '*');

If you delete the * from that, it will no longer display the requirement span. 

Always back up before making changes.

Link to comment
Share on other sites

if you are using 2.3.4 Bootstrap Community version, there are already HTML5 browser relevant tags which make the input required before form submit and validation.

These are:

required aria-required="true"

 

Link to comment
Share on other sites

8 hours ago, hkgenesis said:

can the normal 2.3.4 version change to bootstrap version?

No. You have to back up your database, install the new BS version of osCommerce in another directory, import a copy of your database (and make the necessary adjustments and changes). You will now have a clean installation of osCommerve BS with your database. Now, you can apply any add-ons and/or changes, plus any style changes to make the new store look and feel like your old store.

Malcolm

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...