[-] FO : Fix bug #PSCFV-8917 taxes calculation when changing delivery address
This commit is contained in:
+12
-5
@@ -3415,6 +3415,7 @@ class CartCore extends ObjectModel
|
||||
*/
|
||||
public function setNoMultishipping()
|
||||
{
|
||||
$emptyCache = $result = false;
|
||||
if (Configuration::get('PS_ALLOW_MULTISHIPPING'))
|
||||
{
|
||||
// Upgrading quantities
|
||||
@@ -3433,7 +3434,9 @@ class CartCore extends ObjectModel
|
||||
AND `id_shop` = '.(int)$this->id_shop.'
|
||||
AND id_product = '.$product['id_product'].'
|
||||
AND id_product_attribute = '.$product['id_product_attribute'];
|
||||
Db::getInstance()->execute($sql);
|
||||
$result = Db::getInstance()->execute($sql);
|
||||
if ($result)
|
||||
$emptyCache = true;
|
||||
}
|
||||
|
||||
// Merging multiple lines
|
||||
@@ -3451,15 +3454,16 @@ class CartCore extends ObjectModel
|
||||
}
|
||||
|
||||
// Update delivery address for each product line
|
||||
Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'cart_product`
|
||||
$sql = 'UPDATE `'._DB_PREFIX_.'cart_product`
|
||||
SET `id_address_delivery` = (
|
||||
SELECT `id_address_delivery` FROM `'._DB_PREFIX_.'cart`
|
||||
WHERE `id_cart` = '.(int)$this->id.' AND `id_shop` = '.(int)$this->id_shop.'
|
||||
)
|
||||
WHERE `id_cart` = '.(int)$this->id.'
|
||||
'.(Configuration::get('PS_ALLOW_MULTISHIPPING') ? ' AND `id_shop` = '.(int)$this->id_shop : ''));
|
||||
|
||||
'.(Configuration::get('PS_ALLOW_MULTISHIPPING') ? ' AND `id_shop` = '.(int)$this->id_shop : '');
|
||||
|
||||
$emptyCache = Db::getInstance()->execute($sql);
|
||||
|
||||
if (Customization::isFeatureActive())
|
||||
Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'customization`
|
||||
@@ -3468,6 +3472,9 @@ class CartCore extends ObjectModel
|
||||
WHERE `id_cart` = '.(int)$this->id.'
|
||||
)
|
||||
WHERE `id_cart` = '.(int)$this->id);
|
||||
|
||||
if ($emptyCache)
|
||||
$this->_products = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -80,7 +80,7 @@ class TaxRulesTaxManagerCore implements TaxManagerInterface
|
||||
if (!empty($this->address->postcode))
|
||||
$postcode = $this->address->postcode;
|
||||
|
||||
if (!isset(self::$cache_tax_calculator[$postcode.'-'.$this->type]))
|
||||
if (!isset(self::$cache_tax_calculator[(int)$this->address->id_country.'-'.$postcode.'-'.$this->type]))
|
||||
{
|
||||
$rows = Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
|
||||
Reference in New Issue
Block a user