Steffen Posted October 14, 2012 Share Posted October 14, 2012 (edited) Hello When ordering from my shop, it is required to put in at least one phone number. But if you just leave a "space" or any single character, the system will allow it. Is there some way I can make it so, that 8 numbers are required before you can continue? I need this to work, as I use phone number as a part of my security. Any help is much appreciated! [solved] Change line 84 in ../controllers/AuthController.php to: if ((Tools::getValue('phone') && (strlen(Tools::getValue('phone')) != 8 || !is_numeric(Tools::getValue('phone')))) || (Tools::getValue('phone_mobile') && (strlen(Tools::getValue('phone_mobile')) != 8 || !is_numeric(Tools::getValue('phone_mobile')))) || (!Tools::getValue('phone') && !Tools::getValue('phone_mobile'))) Edited October 17, 2012 by Nondo (see edit history) Link to comment Share on other sites More sharing options...
Carolina Custom Designs Posted October 17, 2012 Share Posted October 17, 2012 Validity of the phone number is checked in /classes/Validate.php, isPhoneNumber() method (PS 1.4). Regular expression allows any of the following combination of characters. +0-9. ()-. If you want to be strict, within this method change the regular expression to read: '/^d{8}$/' But this will not accept, for example, 515-222-4444 and will require 8 consecutive digits. A more sophisticated regex available but... But if you just leave a "space" or any single character, the system will allow it. Consider the possibility that if a customer enters an invalid number maybe they do not want you to have their home phone number. Enforcing 8 digits can result one to enter just 8 zeros, or worse, abandon the cart. There is no logic in enforcing it. Marty Shue Link to comment Share on other sites More sharing options...
innocuous Posted October 27, 2012 Share Posted October 27, 2012 How can we validate mobile number? exactly 10 digits? (We can display "please enter number in format 9xxxxxxxxx) Thanks Link to comment Share on other sites More sharing options...
innocuous Posted November 2, 2012 Share Posted November 2, 2012 anyone? Link to comment Share on other sites More sharing options...
Recommended Posts