update customer number when deleting customer

This commit is contained in:
Shreesh Arora
2024-06-28 13:34:49 +05:30
parent 198e119c83
commit aa35c3637f
2 changed files with 3 additions and 3 deletions

View File

@@ -967,7 +967,7 @@ class AdminCustomersControllerCore extends AdminController
// If customer is going to be deleted permanently then if customer has orders the change this customer as an anonymous customer
if (Validate::isLoadedObject($objCustomer = $this->loadObject())) {
if ($this->delete_mode == 'real' && Order::getCustomerOrders($objCustomer->id, true)) {
$customerEmail = $objCustomer->email;
$customerEmail = $objCustomer->email;
$objCustomer->email = 'anonymous'.'-'.$objCustomer->id.'@'.Tools::getShopDomain();
$objCustomer->deleted = 1;
if (!$objCustomer->update()) {
@@ -976,7 +976,7 @@ class AdminCustomersControllerCore extends AdminController
} else {
if ($customerDetail = CartCustomerGuestDetail::getCustomerDefaultDetails($customerEmail)) {
$objCartCustomerGuestDetail = new CartCustomerGuestDetail($customerDetail['id_customer_guest_detail']);
$objCartCustomerGuestDetail->phone = preg_replace('/[0-p]/', 'x', $objCustomer->phone);
$objCartCustomerGuestDetail->phone = preg_replace('/[0-p]/', '0', $objCustomer->phone);
$objCartCustomerGuestDetail->email = $objCustomer->email;
$objCartCustomerGuestDetail->save();
}