[-] MO: fix smarty cache ttl on blocktopmenu and blockcategories

This commit is contained in:
rGaillard
2012-08-06 12:14:03 +00:00
parent cb0a8347c7
commit d356d8d5da
2 changed files with 3 additions and 5 deletions
+2 -4
View File
@@ -166,7 +166,7 @@ class BlockCategories extends Module
$id_category = (int)Tools::getValue('id_category', 0);
$id_lang = (int)$params['cookie']->id_lang;
$smartyCacheId = 'blockcategories|'.$id_current_shop.'_'.$groups.'_'.$id_lang.'_'.$id_product.'_'.$id_category;
$this->context->smarty->cache_lifetime = 31536000; // 1 Year
Tools::enableCache();
if (!$this->isCached('blockcategories.tpl', $smartyCacheId))
{
@@ -223,7 +223,6 @@ class BlockCategories extends Module
$this->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl');
$this->smarty->assign('isDhtml', $isDhtml);
}
$this->context->smarty->cache_lifetime = 31536000; // 1 Year
$display = $this->display(__FILE__, 'blockcategories.tpl', $smartyCacheId);
Tools::restoreCacheSettings();
return $display;
@@ -240,7 +239,7 @@ class BlockCategories extends Module
$id_category = (int)(Tools::getValue('id_category', 0));
$id_lang = (int)($params['cookie']->id_lang);
$smartyCacheId = 'blockcategories|'.$id_current_shop.'_'.$groups.'_'.$id_lang.'_'.$id_product.'_'.$id_category;
$this->context->smarty->cache_lifetime = 31536000; // 1 Year
Tools::enableCache();
if (!$this->isCached('blockcategories_footer.tpl', $smartyCacheId))
{
@@ -302,7 +301,6 @@ class BlockCategories extends Module
$this->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl');
$this->smarty->assign('isDhtml', $isDhtml);
}
$this->context->smarty->cache_lifetime = 31536000; // 1 Year
$display = $this->display(__FILE__, 'blockcategories_footer.tpl', $smartyCacheId);
Tools::restoreCacheSettings();
return $display;
+1 -1
View File
@@ -717,6 +717,7 @@ class Blocktopmenu extends Module
$this->user_groups = ($this->context->customer->isLogged() ? $this->context->customer->getGroups() : array(Configuration::get('PS_UNIDENTIFIED_GROUP')));
$this->page_name = Dispatcher::getInstance()->getController();
$smarty_cache_id = 'blocktopmenu-'.$this->page_name.'-'.(int)$this->context->shop->id.'-'.implode(', ',$this->user_groups).'-'.(int)$this->context->language->id.'-'.(int)Tools::getValue('id_category').'-'.(int)Tools::getValue('id_manufacturer').'-'.(int)Tools::getValue('id_supplier').'-'.(int)Tools::getValue('id_cms').'-'.(int)Tools::getValue('id_product');
$this->context->smarty->cache_lifetime = 31536000;
Tools::enableCache();
if (!$this->isCached('blocktopmenu.tpl', $smarty_cache_id))
{
@@ -730,7 +731,6 @@ class Blocktopmenu extends Module
$this->context->controller->addJS($this->_path.'js/superfish-modified.js');
$this->context->controller->addCSS($this->_path.'css/superfish-modified.css');
$this->context->smarty->cache_lifetime = 31536000;
$html = $this->display(__FILE__, 'blocktopmenu.tpl', $smarty_cache_id);
Tools::restoreCacheSettings();
return $html;