// Add cache on products stock
This commit is contained in:
1 parent
56f093e943
commit
dd41cb98a2
1 file changed
+3
-3
+3
-3
@@ -204,7 +204,7 @@ class ProductCore extends ObjectModel
|
||||
protected static $producPropertiesCache = array();
|
||||
|
||||
/** @var array cache stock data in getStock() method */
|
||||
protected $cacheStock = array();
|
||||
protected static $cacheStock = array();
|
||||
|
||||
/** @var array tables */
|
||||
protected $tables = array ('product', 'product_lang');
|
||||
@@ -2087,7 +2087,7 @@ class ProductCore extends ObjectModel
|
||||
'quantity' => $quantity,
|
||||
), 'INSERT');
|
||||
|
||||
$this->cacheStock[$id_product_attribute] = null;
|
||||
self::$cacheStock[$this->id][$id_product_attribute] = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2105,7 +2105,7 @@ class ProductCore extends ObjectModel
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
|
||||
if (!isset($this->cacheStock[$id_product_attribute]))
|
||||
if (!isset(self::$cacheStock[$this->id][$id_product_attribute]))
|
||||
{
|
||||
$sql = 'SELECT quantity
|
||||
FROM '._DB_PREFIX_.'stock
|
||||
|
||||
Reference in new issue
Block a user