Updated: id_address_delivery is now set as 0 by default

This commit is contained in:
Shreesh Arora
2024-07-23 14:58:20 +05:30
parent 05964925a9
commit 28996df417
8 changed files with 47 additions and 72 deletions

View File

@@ -365,13 +365,13 @@ class FrontControllerCore extends Controller
$cart->update();
}
/* Select an address if not set */
if (isset($cart) && (!isset($cart->id_address_delivery) || $cart->id_address_delivery == 0 ||
!isset($cart->id_address_invoice) || $cart->id_address_invoice == 0) && $this->context->cookie->id_customer) {
if (isset($cart)
&& (!isset($cart->id_address_invoice)
|| $cart->id_address_invoice == 0
)
&& $this->context->cookie->id_customer
) {
$to_update = false;
if (!isset($cart->id_address_delivery) || $cart->id_address_delivery == 0) {
$to_update = true;
$cart->id_address_delivery = (int)Address::getFirstCustomerAddressId($cart->id_customer);
}
if (!isset($cart->id_address_invoice) || $cart->id_address_invoice == 0) {
$to_update = true;
$cart->id_address_invoice = (int)Address::getFirstCustomerAddressId($cart->id_customer);
@@ -391,10 +391,8 @@ class FrontControllerCore extends Controller
$cart->id_shop = $this->context->shop->id;
if ($this->context->cookie->id_customer) {
$cart->id_customer = (int)$this->context->cookie->id_customer;
$cart->id_address_delivery = (int)Address::getFirstCustomerAddressId($cart->id_customer);
$cart->id_address_invoice = (int)$cart->id_address_delivery;
} else {
$cart->id_address_delivery = 0;
$cart->id_address_invoice = 0;
}