badmintongrej Posted January 14, 2014 Share Posted January 14, 2014 (edited) Hello prestashoppers I am having a problem with my checkout. How do I make it so that you only can enter exactly 8 numbers in the phone number, during checkout? I am using the default theme Best regards Jacob Edited January 16, 2014 by badmintongrej (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted January 14, 2014 Share Posted January 14, 2014 check this topic: http://www.prestashop.com/forums/topic/276105-solved-phone-number-fixed-length/ Link to comment Share on other sites More sharing options...
badmintongrej Posted January 14, 2014 Author Share Posted January 14, 2014 check this topic: http://www.prestashop.com/forums/topic/276105-solved-phone-number-fixed-length/ Hello! I did the wrong thing.. I copied the thing you wrote, but in the wrong place.. Now I can find the code I overwrite.. I talking about the code which stands in the classes/Validate.php line 29-32? Hope you understand my question and you can find the code! Thank you Link to comment Share on other sites More sharing options...
vekia Posted January 14, 2014 Share Posted January 14, 2014 what ps version? because i checked my validation file and i've got totally diferent code in lines you mentioned Link to comment Share on other sites More sharing options...
badmintongrej Posted January 15, 2014 Author Share Posted January 15, 2014 what ps version? because i checked my validation file and i've got totally diferent code in lines you mentioned my version is PrestaShop version: 1.5.4.1 Do you have the whole Validate.php file to that version ? Best regards Jacob Link to comment Share on other sites More sharing options...
badmintongrej Posted January 15, 2014 Author Share Posted January 15, 2014 my version is PrestaShop version: 1.5.4.1 Do you have the whole Validate.php file to that version ? Best regards Jacob Or can i mabye find the Validate.php file somewhere, myself ? Link to comment Share on other sites More sharing options...
vekia Posted January 15, 2014 Share Posted January 15, 2014 line 516 there is code: public static function isPhoneNumber($number) { return preg_match('/^[+0-9. ()-]*$/', $number); } change it to: public static function isPhoneNumber($number){ if (strlen($number)==8){ return preg_match('/^[+0-9. ()-]*$/', $number); }else{ return false; } } Link to comment Share on other sites More sharing options...
badmintongrej Posted January 15, 2014 Author Share Posted January 15, 2014 line 516 there is code: public static function isPhoneNumber($number) { return preg_match('/^[+0-9. ()-]*$/', $number); } change it to: public static function isPhoneNumber($number){ if (strlen($number)==8){ return preg_match('/^[+0-9. ()-]*$/', $number); }else{ return false; } } That helped on the phone number, but now i get these messages when I type in my First name, Last name & city If you want to take a look at my code, here it is: (http://codepad.org/HzCWTaQd) I think it is from an other version.... do you have the one fitting for my version ? Link to comment Share on other sites More sharing options...
vekia Posted January 15, 2014 Share Posted January 15, 2014 what does these messages mean? weird, because isPhone function aren't related to other fields. only to phone field, nothing more. Link to comment Share on other sites More sharing options...
badmintongrej Posted January 15, 2014 Author Share Posted January 15, 2014 what does these messages mean? weird, because isPhone function aren't related to other fields. only to phone field, nothing more. it says that First name, Last name & city is wrong... But I am wondering if you have the default validate.php file to prestashop verison 1.5.4.1 ? Because my friend did something wrong when adding the code :/ and if i get the default one for this verison i can change it myself Best regards Jacob Link to comment Share on other sites More sharing options...
vekia Posted January 15, 2014 Share Posted January 15, 2014 sure i've got it you can download it from here: http://pastebin.com/aNkr8Snq Link to comment Share on other sites More sharing options...
badmintongrej Posted January 16, 2014 Author Share Posted January 16, 2014 sure i've got it you can download it from here: http://pastebin.com/aNkr8Snq Thanks man Now I have put in the validate file but i still get the same mistake as before (it says that Last name, First name and city is invalid), do you have any clue on how to fix this ? Best regards Jacob Link to comment Share on other sites More sharing options...
badmintongrej Posted January 16, 2014 Author Share Posted January 16, 2014 Thanks man Now I have put in the validate file but i still get the same mistake as before (it says that Last name, First name and city is invalid), do you have any clue on how to fix this ? Best regards Jacob Fixed it ! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now