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:
@@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user