[-] FO : fixed mixed cache in different shops #PSCFV-3174

This commit is contained in:
dMetzger
2012-08-27 16:48:39 +00:00
parent 538c793cfe
commit 094e6bb24a
3 changed files with 23 additions and 9 deletions
+9 -8
View File
@@ -3978,18 +3978,19 @@ class ProductCore extends ObjectModel
{
if (!((int)$id_product > 0) || !is_array($categories) || empty($categories))
return false;
$sql = 'SELECT id_product FROM `'._DB_PREFIX_.'category_product` WHERE `id_product`='.(int)$id_product.' AND `id_category` IN(';
$sql = 'SELECT id_product FROM `'._DB_PREFIX_.'category_product` WHERE `id_product` = '.(int)$id_product.' AND `id_category` IN (';
foreach ($categories as $category)
$sql .= (int)$category['id_category'].',';
$sql = rtrim($sql, ',').')';
if (isset(self::$_incat[md5($sql)]))
return self::$_incat[md5($sql)];
if (!Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql))
return false;
self::$_incat[md5($sql)] = (Db::getInstance(_PS_USE_SQL_SLAVE_)->NumRows() > 0 ? true : false);
return self::$_incat[md5($sql)];
$hash = md5($sql);
if (!isset(self::$_incat[$hash]))
{
if (!Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql))
return false;
self::$_incat[$hash] = (Db::getInstance(_PS_USE_SQL_SLAVE_)->NumRows() > 0 ? true : false);
}
return self::$_incat[$hash];
}
public function getNoPackPrice()