Jump to content

Customer changing address impacts past orders!


Recommended Posts

Hello,

 

I have just observed an interesting behavior on my shop (1.5.4).

When customer changes an address (via his account) it is automatically changed in past orders.

 

Exact scenario:

1. Client makes an order 11 with delivery to "My address"

2. Shop ships the purchase 

3. Client goes to his account and changes "My address" to some other location

4. You visit order page (order 11) and see that you shipped to wrong address.

 

Have you had this problem? How do you handle this?

 

Any help would be much appreciated!

 

 

Link to comment
Share on other sites

In /controllers/front/AddressController.php is this code:

        // If we edit this address, delete old address and create a new one
        if (Validate::isLoadedObject($this->_address))
        {
            if (Validate::isLoadedObject($country) && !$country->contains_states)
                $address->id_state = 0;
            $address_old = $this->_address;
            if (Customer::customerHasAddress($this->context->customer->id, (int)$address_old->id))
            {
                if ($address_old->isUsed())
                    $address_old->delete();
                else
                {
                    $address->id = (int)($address_old->id);
                    $address->date_add = $address_old->date_add;
                }
            }
        }

Can be that isUsed method returns false?

Check if address is used (at least one order placed)

@return integer Order count for this address

  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...