Jump to content

Edit postal code according to country in the php file


s.elettronew

Recommended Posts

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

  • Like 1
Link to comment
Share on other sites

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

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 by Nickovitshj (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...