Prestashop: Modifying an address in order table creates another address instead of changing the original one

Created on 16 Jan 2019  路  18Comments  路  Source: PrestaShop/PrestaShop

Describe the bug
Once an order is placed, you can modify one of the addresses. This will open the address tab; once you click on Save, a new address will be added to Prestashop instead of modifying the existing one. This worked properly in PS 1.6, but it doesn't in PS 1.7.

To Reproduce

  1. Place an order
  2. Open the order in backoffice
  3. Click on Modify next to the address
  4. Check the list of addresses in backoffice to see that a new address was added

Screenshots

order_tab_00

order_tab_01

Additional information
PrestaShop version: 1.7
PHP version: 7.1

1.7.4.4 1.7.5.0 Addresses BO Fixed Invoices Order

Most helpful comment

The creation of a new address id will trigger error while a cart is already created with a certain id_address. In checkout process will not find any currier for address.
Cart data need to me updated with new id_address

All 18 comments

Hi @Uff182,

Have you the same issue with this ticket: #11199?
Thanks!

Hi @khouloudbelguith , no, the issue is different. The reported ticket refers to the fact that the suggested addresses are wrong, in my case I'm reporting the fact that the address you want to modify is left untouched and a new one is created. Let's say that in the first address you wrote "Street name, number 42", but you actually meant "Street name, number 41", you will end up with two addresses that are basically equals, qith just that detail changed.
This also causes problems when we develop a module that requires address id to display previously saved data (related to that ID): while on 1.6 the additional data are displayed, in 1.7 those informations are lost because the order gets a new address.

@Uff182, thanks for this clarifications.
I manage to reproduce the issue with PS1.7.5.0 & PS1.7.4.4.
We will see how to fix it.
Thanks!

Hello,
I think it's crazy to can change an invoice address
The best way is to deleted this button when a invoice is set to an order.

https://www.prestashop.com/fr/blog/module-de-certification-article88

Hi @Uff182 and @okom3pom,

@Uff182 you are right, it's a bug if we allow editing it should be without adding a new address for the customer. For now, the only way to not pollute your addresses database it's to change it on 'Addresses' directly in 'Customer' menu (not the fastest way).

But as @okom3pom said with the new data regulation (88 article and RGPD and so on), we need to be careful. Our jurist team is working on this specific question.

We will come with the new answer soon.
Thank you all for your feedback.

Hello @Uff182 and @okom3pom,

So any customer can ask to change their address before billing so in some cases the feature is required. But a merchant can't change the invoice when it is sent to the customer. @okom3pom, in the next version we will improve the feature blocking addresses changes when the invoice was sent to the customer.

Thank you all,

Thank's

Reproduced in PS1.7.4.4

  • Account with just shipping address (billing is same as the shipping)
  • Remove check "Use this address also for the billing"
  • Add the billing address
    So now I have 3 shipping addresses and 3 billing addresses

Reproduced in PS 1.7.5
When changing addressee in addition of creating a new addressee , shipping fees are not being recalculated correctly (because shipping fees are related to state_id, when changing state => shipping fees should be recalculated).

Related to #12394 & #13537

The creation of a new address id will trigger error while a cart is already created with a certain id_address. In checkout process will not find any currier for address.
Cart data need to me updated with new id_address

To sum up:

It is normal that when we edit an address that has already been used in a completed order, it creates another entry in the database.

What we want to do here is to keep the backoffice from being able to link a completed invoice to another address. An invoice's address should always be the same once it has been sent to the customer.

To sum up:

It is normal that when we edit an address that has already been used in a completed order, it creates another entry in the database.

What we want to do here is to keep the backoffice from being able to link a completed invoice to another address. An invoice's address should always be the same once it has been sent to the customer.

Hi, it is not normal though that, if you edit an order which is (for example) in a status like "Awaiting payment with bank transfer", the website creates another address instead of modifying the current one I think.
In case the customer placed more than one order and the current address can't be modified because there are previous orders in completed status, instead, it would be useful to have a hook where we get the previous address ID and the new one (something link actionAddressDuplicationAfter): in this way we would be able to detect the address duplication and bring over custom informations assigned by our modules to the customer's address from the old to the new one.

Thank you for your suggestion @Uff182, I ping the pms for their input about this.

@colinegin, what do you think?

(In the mean time I'll talk about your hook suggestion with other core team developers)

To sum up:
It is normal that when we edit an address that has already been used in a completed order, it creates another entry in the database.
What we want to do here is to keep the backoffice from being able to link a completed invoice to another address. An invoice's address should always be the same once it has been sent to the customer.

Hi, it is not normal though that, if you edit an order which is (for example) in a status like "Awaiting payment with bank transfer", the website creates another address instead of modifying the current one I think.
In case the customer placed more than one order and the current address can't be modified because there are previous orders in completed status, instead, it would be useful to have a hook where we get the previous address ID and the new one (something link actionAddressDuplicationAfter): in this way we would be able to detect the address duplication and bring over custom informations assigned by our modules to the customer's address from the old to the new one.

I've just tested it on 1.6, it seems the behaviour is the same. Could you give me more information about it ?

@SharmPRO your issue seems to be the same as #9932, we have a PR currently in test.

I can't reproduce the issue in the 1.7.7 version, the address is edit for the current order and new orders but the old one is kept the old address to avoid undesired changes.

Hi @khouloudbelguith or @florine2623 , when you have time could you do a double check on this issue? I think we can close it.

Hello @Uff182 @okom3pom ,
This issue has been fixed in PS 1.7.7. The whole order page has been reworked.
After modifying an existing address, there's no new address created.
Here's the result in order page :
Capture d鈥檈虂cran 2020-10-23 a虁 17 42 38
And the address list in customer page :
Capture d鈥檈虂cran 2020-10-23 a虁 17 42 53
So I'll close the issue.
Thanks !

Was this page helpful?
0 / 5 - 0 ratings