Fix variable context

Avoid attribution to the variable $newProducts inside the if. It caused the code to potentially misbehave throwing errors of:
"variable $newProducts not defined".
This commit is contained in:
2013-09-01 22:47:41 +01:00
parent f7fefe789d
commit 5f1e08e7e2
@@ -111,7 +111,10 @@ class BlockNewProducts extends Module
{
if (!$this->isCached('blocknewproducts.tpl', $this->getCacheId()))
{
if (!Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY') && !($newProducts = Product::getNewProducts((int)$params['cookie']->id_lang, 0, (int)Configuration::get('NEW_PRODUCTS_NBR'))))
if (!Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY'))
return;
$newProducts = Product::getNewProducts((int) $params['cookie']->id_lang, 0, (int) Configuration::get('NEW_PRODUCTS_NBR'));
if (!$newProducts)
return;
$this->smarty->assign(array(
@@ -151,4 +154,4 @@ class BlockNewProducts extends Module
{
$this->_clearCache('blocknewproducts.tpl');
}
}
}