[-] FO: Fix some tax_display_method value for not default customer group

This commit is contained in:
Rémi Gaillard
2012-12-06 16:38:31 +01:00
parent 276696dd6c
commit 56819e3573
3 changed files with 6 additions and 13 deletions
+1 -3
View File
@@ -154,7 +154,6 @@ class CartCore extends ObjectModel
$customer = Context::getContext()->customer; $customer = Context::getContext()->customer;
else else
$customer = new Customer((int)$this->id_customer); $customer = new Customer((int)$this->id_customer);
$this->_taxCalculationMethod = Group::getPriceDisplayMethod((int)$customer->id_default_group);
if ((!$this->secure_key || $this->secure_key == '-1') && $customer->secure_key) if ((!$this->secure_key || $this->secure_key == '-1') && $customer->secure_key)
{ {
@@ -162,8 +161,7 @@ class CartCore extends ObjectModel
$this->save(); $this->save();
} }
} }
else $this->_taxCalculationMethod = Group::getPriceDisplayMethod(Group::getCurrent()->id);
$this->_taxCalculationMethod = Group::getDefaultPriceDisplayMethod();
} }
+4 -3
View File
@@ -225,7 +225,7 @@ class ProductCore extends ObjectModel
*/ */
public $category; public $category;
public static $_taxCalculationMethod = PS_TAX_EXC; public static $_taxCalculationMethod = null;
protected static $_prices = array(); protected static $_prices = array();
protected static $_pricesLevel2 = array(); protected static $_pricesLevel2 = array();
protected static $_incat = array(); protected static $_incat = array();
@@ -510,8 +510,9 @@ class ProductCore extends ObjectModel
public static function getTaxCalculationMethod($id_customer = null) public static function getTaxCalculationMethod($id_customer = null)
{ {
if ($id_customer) if (self::$_taxCalculationMethod === null || $id_customer !== null)
Product::initPricesComputation((int)$id_customer); Product::initPricesComputation($id_customer);
return (int)self::$_taxCalculationMethod; return (int)self::$_taxCalculationMethod;
} }
+1 -7
View File
@@ -53,13 +53,7 @@ class BlockCart extends Module
else else
$currency = $this->context->currency; $currency = $this->context->currency;
if ($params['cart']->id_customer) $taxCalculationMethod = Group::getPriceDisplayMethod((int)Group::getCurrent()->id);
{
$customer = new Customer((int)$params['cart']->id_customer);
$taxCalculationMethod = Group::getPriceDisplayMethod((int)$customer->id_default_group);
}
else
$taxCalculationMethod = Group::getDefaultPriceDisplayMethod();
$useTax = !($taxCalculationMethod == PS_TAX_EXC); $useTax = !($taxCalculationMethod == PS_TAX_EXC);