s.elettronew Posted February 28, 2022 Share Posted February 28, 2022 Hi guys, I need to change the postal code at the moment of the check out (the moudle is Onepagecheckout). The target is to do a str_replace() of postal cose according to country of the address, before the data stored in wp_address. Ho provato a dare uno sguardo alle classi (sono neofita di prestashop), e l'unica classe che mi salta all'occhio dove potrei intervenire è : I try to take a look at the classes (i'm new in prestashop), et there is a few classes that i think could be the rights, the best one is: -Classes/Address.php in the function initialize(); But i tested a few solutions but nothing happen. Some ideas? Thank you 1 Link to comment Share on other sites More sharing options...
Nickovitshj Posted February 28, 2022 Share Posted February 28, 2022 You want to change a zip code that is being entered by an end-user? Mind me asking why? Link to comment Share on other sites More sharing options...
s.elettronew Posted February 28, 2022 Author Share Posted February 28, 2022 Yes exactly Link to comment Share on other sites More sharing options...
Nickovitshj Posted February 28, 2022 Share Posted February 28, 2022 I don't know exactly how to do achieve this. But in the meantime you could change the zip codes from the backoffice in the order detail view as an admin. But I still don't understand why you want to do this. Link to comment Share on other sites More sharing options...
s.elettronew Posted February 28, 2022 Author Share Posted February 28, 2022 I have to do this automatically. Because some shipping company don't accept some char (like "-") in the post code, and the API of company shipping is join toSmarty (so i can't do this with before the call by API happen). I saw that at the moment i insert the data on the form, with a AJAX automaticallt is saved. So even if i don't click on the button for terminate the order, the data are automatically stored in DB. I think i have to operate in JS for do that Link to comment Share on other sites More sharing options...
Nickovitshj Posted March 1, 2022 Share Posted March 1, 2022 (edited) One solution could be to have validation on the input field? You could then limit what kind of characters they can enter via a RegEx (Regular expression) For example: with the following RegEx: ^\d{4}$ You could limit their input to 4 numbers, such as 4902, 2309, 1122,... You could block "-" that way. Thing is, you would limit your customers as they are trying to enter the information. Edited March 1, 2022 by Nickovitshj (see edit history) 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