[-] FO : #PSFV-815 - Fix bug on the cart with carrier on updating the country of the address
This commit is contained in:
1 parent
726cbb6e1c
commit
2735f855c9
1 file changed
+18
-22
@@ -201,25 +201,7 @@ class AddressControllerCore extends FrontController
|
|||||||
if (Customer::customerHasAddress($this->context->customer->id, (int)$address_old->id))
|
if (Customer::customerHasAddress($this->context->customer->id, (int)$address_old->id))
|
||||||
{
|
{
|
||||||
if ($address_old->isUsed())
|
if ($address_old->isUsed())
|
||||||
{
|
|
||||||
$address_old->delete();
|
$address_old->delete();
|
||||||
if (!Tools::isSubmit('ajax'))
|
|
||||||
{
|
|
||||||
$to_update = false;
|
|
||||||
if ($this->context->cart->id_address_invoice == $address_old->id)
|
|
||||||
{
|
|
||||||
$to_update = true;
|
|
||||||
$this->context->cart->id_address_invoice = 0;
|
|
||||||
}
|
|
||||||
if ($this->context->cart->id_address_delivery == $address_old->id)
|
|
||||||
{
|
|
||||||
$to_update = true;
|
|
||||||
$this->context->cart->id_address_delivery = 0;
|
|
||||||
}
|
|
||||||
if ($to_update)
|
|
||||||
$this->context->cart->update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$address->id = (int)($address_old->id);
|
$address->id = (int)($address_old->id);
|
||||||
@@ -231,12 +213,26 @@ class AddressControllerCore extends FrontController
|
|||||||
// Save address
|
// Save address
|
||||||
if ($result = $address->save())
|
if ($result = $address->save())
|
||||||
{
|
{
|
||||||
// In order to select this new address : order-address.tpl
|
// Update id address of the current cart if necessary
|
||||||
if ((bool)Tools::getValue('select_address', false) || ($this->ajax && Tools::getValue('type') == 'invoice'))
|
if ($address_old->isUsed())
|
||||||
{
|
{
|
||||||
// This new adress is for invoice_adress, select it
|
if ($this->context->cart->id_address_invoice == $address_old->id)
|
||||||
$this->context->cart->id_address_invoice = (int)$address->id;
|
{
|
||||||
|
$to_update = true;
|
||||||
|
$this->context->cart->id_address_invoice = (int)$address->id;
|
||||||
|
}
|
||||||
|
if ($this->context->cart->id_address_delivery == $address_old->id)
|
||||||
|
{
|
||||||
|
$to_update = true;
|
||||||
|
$this->context->cart->id_address_delivery = (int)$address->id;
|
||||||
|
}
|
||||||
$this->context->cart->update();
|
$this->context->cart->update();
|
||||||
|
|
||||||
|
$sql = 'UPDATE `'._DB_PREFIX_.'cart_product`
|
||||||
|
SET `id_address_delivery` = '.(int)$address->id.'
|
||||||
|
WHERE `id_cart` = '.(int)$this->context->cart->id.'
|
||||||
|
AND `id_address_delivery` = '.(int)$address_old->id;
|
||||||
|
Db::getInstance()->execute($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->ajax)
|
if ($this->ajax)
|
||||||
|
|||||||
Reference in new issue
Block a user