Jump to content

Customer address not saved


Nilis

Recommended Posts

Hi everyone,

I have been testing the upgrade of my prestashop installation going from 1.6.1.24 to 1.7.8.11 and continuing to 8.2.3.

I must say, it went pretty smoothly. Ofcourse i had the incompatible modules that needed updating and i had reset the theme to classic.

During testing, i came across an issue that a customer could enter their address (step 2 of checkout), but it would not save. Instead, the form would return to step 2 and in the url i could see ?id_address=0 was added.

I then tried to add an address to the customer from the backoffice, but that also failed. That made me think this has to be a database problem.

I compared the schemas for ps_address and there were indeed differences. After running the following sql statements to fix the discrepancies, I was able to add addresses using the backoffice:

image.thumb.png.6adb2a19977f4e1f3107c4a034e740be.png

However, the front office wasn't working. When trying to add an address to a customer's account, i always got the "Please fix the error below." message on top of the form, but all fields were OK (not red). I debugged it and it returned nothing in the error array. So field validation was OK.

Next up was this piece of code in the validate function of "classes/form/CustomerAddressForm.php"

image.thumb.png.39be34df0a8a6f92950fdcb507fd6baa.png

The if statement would always fire the inner code, meaning that the Hook check was never empty ('').
I did some debugging on this and $hookReturn returned null (not an empty string) and possibly an empty array (i had this result during some testing).

So i changed the code into:

image.thumb.png.6725acc8227a6ccf32fd44447f21cfd4.png

And now my address is being saved properly in the back office and the front office.

My question, shouldn't this hit all people on 8.2.3 that have no hooks for 'actionValidateCustomerAddressForm'. Or am i missing a hook?

PS: Why on earth is cloudflare blocking this forum post when i use the <> code. I have now pasted it as images, which is stupid.

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...