Merge pull request #788 from abhishek-webkul/gli-1422

Fixed: Error when updating address from customer acccount which has been used to create an order at front office
This commit is contained in:
Rohit Jain
2024-01-25 17:13:32 +05:30
committed by GitHub
2 changed files with 3 additions and 3 deletions

View File

@@ -180,7 +180,7 @@ class AddressCore extends ObjectModel
{
// for customer address we need to check of customer address already exists.
if ($this->id_customer) {
if ($id_address = Customer::getCustomerIdAddress($this->id_customer)) {
if ($id_address = Customer::getCustomerIdAddress($this->id_customer, false)) {
return false;
}
}

View File

@@ -465,10 +465,10 @@ class CustomerCore extends ObjectModel
return Cache::retrieve($cache_id);
}
public static function getCustomerIdAddress($id_customer)
public static function getCustomerIdAddress($id_customer, $use_cache = true)
{
$cache_id = 'Customer::getCustomerIdAddress'.(int)$id_customer;
if (!Cache::isStored($cache_id)) {
if (!$use_cache || !Cache::isStored($cache_id)) {
$sql = 'SELECT id_address
FROM `'._DB_PREFIX_.'address` a
WHERE `id_customer` = '.(int)$id_customer.' AND a.`deleted` = 0';