From 8f81af04634f0597193a31ed243856be2fb33e79 Mon Sep 17 00:00:00 2001 From: Jerome Nadaud Date: Thu, 14 Nov 2013 15:12:08 +0100 Subject: [PATCH] // fix on blockcategories --- modules/blockcategories/blockcategories.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/modules/blockcategories/blockcategories.php b/modules/blockcategories/blockcategories.php index cdeb1a424..a66f5326e 100644 --- a/modules/blockcategories/blockcategories.php +++ b/modules/blockcategories/blockcategories.php @@ -128,12 +128,10 @@ class BlockCategories extends Module foreach ($resultParents[$id_category] as $subcat) $children[] = $this->getTree($resultParents, $resultIds, $maxDepth, $subcat['id_category'], $currentDepth + 1); - if (!isset($resultIds[$id_category])) - return false; - + $category = new Category($id_category); $thumbnails = array(); - if ($currentDepth == 0) + if ($category->level_depth == 2) { $files = scandir(_PS_CAT_IMG_DIR_); @@ -142,12 +140,12 @@ class BlockCategories extends Module $thumbnails[] = ImageManager::thumbnail(_PS_CAT_IMG_DIR_.$file, 'category_'.$file, 100, 'jpg', true, true); } - + $return = array( 'id' => $id_category, - 'link' => $this->context->link->getCategoryLink($id_category, $resultIds[$id_category]['link_rewrite']), - 'name' => $resultIds[$id_category]['name'], - 'desc'=> $resultIds[$id_category]['description'], + 'link' => $this->context->link->getCategoryLink($id_category, $category->link_rewrite[(int)$this->context->language->id]), + 'name' => $category->name[(int)$this->context->language->id], + 'desc'=> $category->description[(int)$this->context->language->id], 'children' => $children, 'thumbnails' => $thumbnails ); @@ -238,7 +236,7 @@ class BlockCategories extends Module $resultIds[$row['id_category']] = &$row; } - $blockCategTree = $this->getTree($resultParents, $resultIds, $maxdepth, ($category ? $category->id : null)); + $blockCategTree = $this->getTree($resultParents, $resultIds, $maxdepth, ($category && (!isset($params['is_top_menu']) || !$params['is_top_menu']) ? $category->id : null)); $this->smarty->assign('blockCategTree', $blockCategTree); if ($category)