Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Telephone with prefix on create account?


makeholer

Recommended Posts

Hello,

 

How can i add a prefix before the number on the create account? i see it on lot of sites, when the field is empty its like:

 

(__)________

 

so when the costumer type it will be 2 prefix number and 8 phone number, any idea to add this?

 

Thanks in adv,

Marco Castellari

Link to comment
Share on other sites

I searched all day, now i know i need to use a mask in js, with placeholders, i found one named maskedinput, but i dont know how can i declare the function on this:

 

		  <tr>
		    <td class="main"><?php echo ENTRY_TELEPHONE_NUMBER; ?><br>
		    <?php echo tep_draw_input_field('telephone') . ' ' . (tep_not_null(ENTRY_TELEPHONE_NUMBER_TEXT)
	    ? '<span class="inputRequirement">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?></td>
	 </tr>

 

I'll appreciate any help

Link to comment
Share on other sites

you modify the create_account.php, language file and admin and mysql the following way:

 

modification of create_account.php

find:

$telephone = tep_db_prepare_input($HTTP_POST_VARS['telephone']);

change to:

$telephone_prefix = tep_db_prepare_input($HTTP_POST_VARS['telephone_prefix']);
$telephone = tep_db_prepare_input($HTTP_POST_VARS['telephone']);

 

find:

if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {

  $error = true;

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

 

 

change to:

if (strlen($telephone_prefix) < ENTRY_TELEPHONE_PREFIX_MIN_LENGTH) {
  $error = true;

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

 

find:

$sql_data_array = array('customers_firstname' => $firstname,
						  'customers_lastname' => $lastname,
						  'customers_email_address' => $email_address,
						  'customers_telephone' => $telephone,
						  'customers_fax' => $fax,
						  'customers_newsletter' => $newsletter,
						  'customers_password' => tep_encrypt_password($password));

 

change to:

$sql_data_array = array('customers_firstname' => $firstname,
						  'customers_lastname' => $lastname,
						  'customers_email_address' => $email_address,
						  'customers_telephone_prefix' => $telephone_prefix,
						  'customers_telephone' => $telephone,
						  'customers_fax' => $fax,
						  'customers_newsletter' => $newsletter,
						  'customers_password' => tep_encrypt_password($password));

 

find:

 <tr>
			<td class="main"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td>
			<td class="main"><?php echo tep_draw_input_field('telephone') . ' ' . (tep_not_null(ENTRY_TELEPHONE_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?></td>
		  </tr>

 

change to:

 <tr>
			<td class="main"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td>
			<td class="main"><?php echo tep_draw_input_field('telephone_prefix') . ' ' . (tep_not_null(ENTRY_TELEPHONE_PREFIX_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_TELEPHONE_PREFIX_NUMBER_TEXT . '</span>': ''); ?> <?php echo tep_draw_input_field('telephone') . ' ' . (tep_not_null(ENTRY_TELEPHONE_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?></td>
		  </tr>

 

now open english.php file or any other languages file:

find:

define('ENTRY_TELEPHONE_NUMBER_ERROR', 'Your Telephone Number must contain a minimum of ' . ENTRY_TELEPHONE_MIN_LENGTH . ' characters.');

change to:

define('ENTRY_TELEPHONE_PREFIX_NUMBER_ERROR', 'The Prefix of Your Telephone Number must contain a minimum of ' . ENTRY_TELEPHONE_PREFIX_MIN_LENGTH . ' characters.');

 

run the following code in mysql:

ALTER TABLE customers ADD COLUMN customers_telephone_prefix INT(10) DEFAULT '0' NULL AFTER customers_default_address_id;

 

simillar way you need to add the oscommerce code to admin control panel, as you can add it to orders/invoices or customer details

Please read this line: Do you want to find all the answers to your questions? click here. As for contribution database it's located here!

8 people out of 10 don't bother to read installation manuals. I can recommend: if you can't read the installation manual, don't bother to install any contribution yourself.

Before installing contribution or editing/updating/deleting any files, do the full backup, it will save to you & everyone here on the forum time to fix your issues.

Any issues with oscommerce, I am here to help you.

Link to comment
Share on other sites

Sorry, I forgot to define the ENTRY_TELEPHONE_PREFIX_MIN_LENGTH, the easiest way:

 

find in create_account.php file:

require('includes/application_top.php');

change to:

 

require('includes/application_top.php');
define('ENTRY_TELEPHONE_PREFIX_MIN_LENGTH', '2');

Please read this line: Do you want to find all the answers to your questions? click here. As for contribution database it's located here!

8 people out of 10 don't bother to read installation manuals. I can recommend: if you can't read the installation manual, don't bother to install any contribution yourself.

Before installing contribution or editing/updating/deleting any files, do the full backup, it will save to you & everyone here on the forum time to fix your issues.

Any issues with oscommerce, I am here to help you.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...