[*] CORE : Cache store for isAssociatedToShop::isAssociatedToShop
This commit is contained in:
1 parent
38da826671
commit
3f9338e13d
2 files changed
+15
-15
No files matched your search
@@ -33,9 +33,6 @@ class TaxRulesTaxManagerCore implements TaxManagerInterface
|
||||
public $type;
|
||||
public $tax_calculator;
|
||||
|
||||
protected static $cache_tax_calculator;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param Address $address
|
||||
@@ -80,8 +77,8 @@ class TaxRulesTaxManagerCore implements TaxManagerInterface
|
||||
if (!empty($this->address->postcode))
|
||||
$postcode = $this->address->postcode;
|
||||
|
||||
$key = (int)$this->address->id_country.'-'.(int)$this->address->id_state.'-'.$postcode.'-'.(int)$this->type;
|
||||
if (!isset(self::$cache_tax_calculator[$key]))
|
||||
$cache_id = (int)$this->address->id_country.'-'.(int)$this->address->id_state.'-'.$postcode.'-'.(int)$this->type;
|
||||
if (!Cache::isStored($cache_id))
|
||||
{
|
||||
$rows = Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
@@ -111,10 +108,8 @@ class TaxRulesTaxManagerCore implements TaxManagerInterface
|
||||
if ($row['behavior'] == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
self::$cache_tax_calculator[$key] = new TaxCalculator($taxes, $behavior);
|
||||
Cache::store($cache_id, new TaxCalculator($taxes, $behavior));
|
||||
}
|
||||
return self::$cache_tax_calculator[$key];
|
||||
return Cache::retrieve($cache_id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user