From fb80b88d81d28caf7bebcc663a43dfeaa97fc92b Mon Sep 17 00:00:00 2001 From: Axome Date: Thu, 2 Jul 2015 10:55:58 +0200 Subject: [PATCH] [-] MO: Level 1 subcategories pointing to home If you add the a level_depth 0 category to the links set (root category) every children categories point to the homepage instead of its own category page. This commit also fixes a warning occuring if the $cat variable is not instanciated due to the conditional test above. --- blocktopmenu.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blocktopmenu.php b/blocktopmenu.php index 2986742..a660220 100644 --- a/blocktopmenu.php +++ b/blocktopmenu.php @@ -601,7 +601,7 @@ protected function generateCategoriesMenu($categories, $is_children = 0) foreach ($categories as $key => $category) { - if ($category['level_depth'] > 1) + if ($category['level_depth'] >= 1) { $cat = new Category($category['id_category']); $link = Tools::HtmlEntitiesUTF8($cat->getLink()); @@ -610,7 +610,7 @@ protected function generateCategoriesMenu($categories, $is_children = 0) $link = $this->context->link->getPageLink('index'); /* Whenever a category is not active we shouldnt display it to customer */ - if ((bool)$cat->active === false) { + if (empty($cat->active)) { break; }