[*] MO: Add smarty cache on some modules

This commit is contained in:
Rémi Gaillard
2013-01-07 17:09:36 +01:00
parent 1f7ab4f172
commit cd89916a20
14 changed files with 136 additions and 95 deletions
+13 -7
View File
@@ -62,14 +62,19 @@ class BlockStore extends Module
public function hookRightColumn($params)
{
$this->smarty->assign('store_img', Configuration::get('BLOCKSTORE_IMG'));
$sql = 'SELECT COUNT(*)
FROM '._DB_PREFIX_.'store s'
.Shop::addSqlAssociation('store', 's');
$total = Db::getInstance()->getValue($sql);
if (!$this->isCached('blockstore.tpl', $this->getCacheId()))
{
$this->smarty->assign('store_img', Configuration::get('BLOCKSTORE_IMG'));
$sql = 'SELECT COUNT(*)
FROM '._DB_PREFIX_.'store s'
.Shop::addSqlAssociation('store', 's');
$total = Db::getInstance()->getValue($sql);
if ($total <= 0)
return;
}
return $this->display(__FILE__, 'blockstore.tpl', $this->getCacheId());
if ($total > 0)
return $this->display(__FILE__, 'blockstore.tpl');
}
public function hookHeader($params)
@@ -94,6 +99,7 @@ class BlockStore extends Module
if (Configuration::hasContext('BLOCKSTORE_IMG', null, Shop::getContext()) && Configuration::get('BLOCKSTORE_IMG') != $_FILES['store_img']['name'])
@unlink(dirname(__FILE__).'/'.Configuration::get('BLOCKSTORE_IMG'));
Configuration::updateValue('BLOCKSTORE_IMG', $_FILES['store_img']['name']);
$this->_clearCache('blockstore.tpl');
return $this->displayConfirmation($this->l('Settings are updated'));
}
}