diff --git a/modules/blocktopmenu/blocktopmenu.php b/modules/blocktopmenu/blocktopmenu.php
index f505bb677..dbb3ca1fa 100644
--- a/modules/blocktopmenu/blocktopmenu.php
+++ b/modules/blocktopmenu/blocktopmenu.php
@@ -554,19 +554,25 @@ class Blocktopmenu extends Module
$children = Category::getChildren((int)$id_category, (int)$id_lang, true, (int)$id_shop);
$selected = ($this->page_name == 'category' && ((int)Tools::getValue('id_category') == $id_category)) ? ' class="sfHoverForce"' : '';
- $this->_menu .= '
';
- $this->_menu .= ''.$category->name.'';
-
- if (count($children))
+ $user_groups = Context::getContext()->customer->isLogged() ? Context::getContext()->customer->getGroups() : array(Configuration::get('PS_UNIDENTIFIED_GROUP'));
+ $is_intersected = array_intersect($category->getGroups(), $user_groups);
+ // filter the categories that the user is allowed to see and browse
+ if (!empty($is_intersected))
{
- $this->_menu .= '';
+ $this->_menu .= '- ';
+ $this->_menu .= ''.$category->name.'';
- foreach ($children as $child)
- $this->getCategory((int)$child['id_category'], (int)$id_lang, (int)$child['id_shop']);
+ if (count($children))
+ {
+ $this->_menu .= '';
+ foreach ($children as $child)
+ $this->getCategory((int)$child['id_category'], (int)$id_lang, (int)$child['id_shop']);
+
+ $this->_menu .= '
';
+ }
+ $this->_menu .= '';
}
- $this->_menu .= '';
}
private function getCMSMenuItems($parent, $depth = 1, $id_lang = false)