Merge branch 'fix-cache-privatesale_family_menu' into develop
This commit is contained in:
commit
27659bb7b9
@ -24,7 +24,24 @@ class Privatesales_Family_Menu extends Module {
|
||||
global $cookie, $smarty;
|
||||
|
||||
$id_lang = (int)$cookie->id_lang;
|
||||
|
||||
/**
|
||||
* @Override cache file
|
||||
*/
|
||||
if (class_exists('CacheRedis')) {
|
||||
$tpl_cache_name = 'sale_privatesales_family_menu_'.(int) $cookie->id_lang.'.html';
|
||||
if (false === ($result = CacheRedis::getInstance()->get($tpl_cache_name, 'privatesales_family_menu'))) {
|
||||
$menus = $this->getTree($cookie->id_lang);
|
||||
if (!$menus) {
|
||||
CacheRedis::getInstance()->set($tpl_cache_name, 'privatesales_family_menu', '', CacheRedis::MEDIUM_TTL);
|
||||
return "";
|
||||
}
|
||||
$smarty->assign(array(
|
||||
'menus' => $menus
|
||||
));
|
||||
$result = $this->display(__FILE__, 'menu.tpl');
|
||||
CacheRedis::getInstance()->set($tpl_cache_name, 'privatesales_family_menu', $result, CacheRedis::MEDIUM_TTL);
|
||||
}
|
||||
} else {
|
||||
$filename = _PS_ROOT_DIR_.'/modules/privatesales_family_menu/menu_'.$id_lang.'.txt';
|
||||
$expire = time() -3600;
|
||||
|
||||
@ -41,13 +58,17 @@ class Privatesales_Family_Menu extends Module {
|
||||
$smarty->assign(array(
|
||||
'menus' => $menus
|
||||
));
|
||||
return $this->display(__FILE__, 'menu.tpl');
|
||||
$result = $this->display(__FILE__, 'menu.tpl');
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function hookPrivateSales_update($params)
|
||||
{
|
||||
if (class_exists('CacheRedis')) {
|
||||
CacheRedis::getInstance()->clear('sale_privatesales*');
|
||||
}
|
||||
$id_langs = array(2,3);
|
||||
|
||||
foreach ($id_langs as $key => $id_lang) {
|
||||
$filename = _PS_ROOT_DIR_.'/modules/privatesales_family_menu/menu_'.$id_lang.'.txt';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user