gloomybear Posted November 10, 2014 Share Posted November 10, 2014 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 More sharing options...
tuk66 Posted November 11, 2014 Share Posted November 11, 2014 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 1 Link to comment Share on other sites More sharing options...
gloomybear Posted November 11, 2014 Author Share Posted November 11, 2014 Thank you tuk66! I used your advice and traced the problem. I use a 3-rd party module OnePageCheckout and this module allows to change address without looking at isUsed method. Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts