[*] CORE : Cache store for isAssociatedToShop::isAssociatedToShop
This commit is contained in:
@@ -1234,11 +1234,16 @@ abstract class ObjectModelCore
|
||||
if ($id_shop === null)
|
||||
$id_shop = Context::getContext()->shop->id;
|
||||
|
||||
$sql = 'SELECT id_shop
|
||||
FROM `'.pSQL(_DB_PREFIX_.$this->def['table']).'_shop`
|
||||
WHERE `'.$this->def['primary'].'` = '.(int)$this->id.'
|
||||
AND id_shop = '.(int)$id_shop;
|
||||
return (bool)Db::getInstance()->getValue($sql);
|
||||
$cache_id = 'objectmodel_shop_'.$this->def['classname'].'_'.(int)$this->id.'-'.(int)$id_shop;
|
||||
if (!Cache::isStored($cache_id))
|
||||
{
|
||||
$sql = 'SELECT id_shop
|
||||
FROM `'.pSQL(_DB_PREFIX_.$this->def['table']).'_shop`
|
||||
WHERE `'.$this->def['primary'].'` = '.(int)$this->id.'
|
||||
AND id_shop = '.(int)$id_shop;
|
||||
Cache::store($cache_id, (bool)Db::getInstance()->getValue($sql));
|
||||
}
|
||||
return Cache::retrieve($cache_id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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