From 5f1e08e7e20dbb2542d8ceee40f3f915567500f4 Mon Sep 17 00:00:00 2001 From: dlage Date: Sun, 1 Sep 2013 22:47:41 +0100 Subject: [PATCH] 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". --- modules/blocknewproducts/blocknewproducts.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/blocknewproducts/blocknewproducts.php b/modules/blocknewproducts/blocknewproducts.php index d5ca90eda..ae04a77ee 100644 --- a/modules/blocknewproducts/blocknewproducts.php +++ b/modules/blocknewproducts/blocknewproducts.php @@ -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'); } -} \ No newline at end of file +}