[-] FO : Fix bug #PSCFV-10606 could not have correct taxCalculationMethod when vat number in customer address
This commit is contained in:
@@ -519,6 +519,17 @@ class ProductCore extends ObjectModel
|
||||
if (!Validate::isLoadedObject($customer))
|
||||
die(Tools::displayError());
|
||||
self::$_taxCalculationMethod = Group::getPriceDisplayMethod((int)$customer->id_default_group);
|
||||
$cur_cart = Context::getContext()->cart;
|
||||
$id_address = 0;
|
||||
if (Validate::isLoadedObject($cur_cart))
|
||||
$id_address = $cur_cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')};
|
||||
$address_infos = Address::getCountryAndState($id_address);
|
||||
|
||||
if (self::$_taxCalculationMethod != PS_TAX_EXC
|
||||
&& !empty($address_infos['vat_number'])
|
||||
&& $address_infos['id_country'] != Configuration::get('VATNUMBER_COUNTRY')
|
||||
&& Configuration::get('VATNUMBER_MANAGEMENT'))
|
||||
self::$_taxCalculationMethod = PS_TAX_EXC;
|
||||
}
|
||||
else
|
||||
self::$_taxCalculationMethod = Group::getPriceDisplayMethod(Group::getCurrent()->id);
|
||||
|
||||
@@ -251,6 +251,8 @@ class FrontControllerCore extends Controller
|
||||
$this->context->cart = $cart;
|
||||
CartRule::autoAddToCart($this->context);
|
||||
}
|
||||
else
|
||||
$this->context->cart = $cart;
|
||||
|
||||
/* get page name to display it in body id */
|
||||
|
||||
@@ -325,7 +327,7 @@ class FrontControllerCore extends Controller
|
||||
'currencies' => Currency::getCurrencies(),
|
||||
'languages' => $languages,
|
||||
'meta_language' => implode('-', $meta_language),
|
||||
'priceDisplay' => Product::getTaxCalculationMethod(),
|
||||
'priceDisplay' => Product::getTaxCalculationMethod((int)$this->context->cookie->id_customer),
|
||||
'add_prod_display' => (int)Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
|
||||
'shop_name' => Configuration::get('PS_SHOP_NAME'),
|
||||
'roundMode' => (int)Configuration::get('PS_PRICE_ROUND_MODE'),
|
||||
|
||||
Reference in New Issue
Block a user