Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Cellphone


nyckeln

Recommended Posts

Posted

Hi!

 

All cellphone number is starting with 07 in Sweden.

How can I make that customers is not allowed to enter a cellphone number when they signup in my store?

 

So when they tries they will get the answer to enter a valid phonenumber, not a cellphone number.

 

Best Regards,

Patrick Andersson

  • 1 month later...
Posted

You're going to have to find the file that handles the input from the signup form (it might be catalog/create_account_process.php). Find the variable name that the phone numberis stored in (i think it is $HTTP_POST_VARS['telephone']). Then you're going to have to run the phone number variable through a regular expression to check to see if the entered data matches "07" for the first two characters.

 

Dont copy this code its just a weak example and I'm no PHP guru.. yet:

 

if ((!eregi("^07",$telephone)))

exit;

 

I have a line like this in create_account_process.php:

 

if (strlen(trim($HTTP_POST_VARS['telephone'])) < CUSTOMERS_TELEPHONE_MIN_LENGTH) { .....

 

i would look there

 

and also a file in the includes dir validations.php

 

I think thats where the email validation lives

 

There is probably already a regular expression in place to make sure it is a valid phone number but im not sure.. in that case you may just have to add to it to make sure it starts with a 07 as well.

 

more on regular expressions:

http://www.phpfreaks.com/javascript_manual...page/regexp.htm

http://us3.php.net/manual/en/function.ereg.php

 

I'm new to osCommerce but I hope this helps....

Archived

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

×
×
  • Create New...