[*] FO: Don't make useless ajax requests to blockcart on the cart page

This commit is contained in:
Rémi Gaillard
2013-05-21 10:56:55 +02:00
parent 0d4fd0729b
commit 3d9596aa99
4 changed files with 26 additions and 8 deletions
+11
View File
@@ -164,6 +164,7 @@ class BlockCart extends Module
parent::install() == false
|| $this->registerHook('top') == false
|| $this->registerHook('header') == false
|| $this->registerHook('actionCartListOverride') == false
|| Configuration::updateValue('PS_BLOCK_CART_AJAX', 1) == false)
return false;
return true;
@@ -195,10 +196,20 @@ class BlockCart extends Module
return $res;
}
public function hookActionCartListOverride($params)
{
if (!Configuration::get('PS_BLOCK_CART_AJAX'))
return;
$this->assignContentVars(array('cookie' => $this->context->cookie, 'cart' => $this->context->cart));
$params['json'] = $this->display(__FILE__, 'blockcart-json.tpl');
}
public function hookHeader()
{
if (Configuration::get('PS_CATALOG_MODE'))
return;
$this->context->controller->addCSS(($this->_path).'blockcart.css', 'all');
if ((int)(Configuration::get('PS_BLOCK_CART_AJAX')))
$this->context->controller->addJS(($this->_path).'ajax-cart.js');