[-] MO : BugFix #PSCFV-2114 blocktopmenu : filter the categories that the user is allowed to see and browse

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@14913 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
vChabot
2012-04-26 14:16:47 +00:00
parent f38483a4e0
commit 2866d92d2b
+15 -9
View File
@@ -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 .= '<li '.$selected.'>';
$this->_menu .= '<a href="'.$category_link.'">'.$category->name.'</a>';
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 .= '<ul>';
$this->_menu .= '<li '.$selected.'>';
$this->_menu .= '<a href="'.$category_link.'">'.$category->name.'</a>';
foreach ($children as $child)
$this->getCategory((int)$child['id_category'], (int)$id_lang, (int)$child['id_shop']);
if (count($children))
{
$this->_menu .= '<ul>';
$this->_menu .= '</ul>';
foreach ($children as $child)
$this->getCategory((int)$child['id_category'], (int)$id_lang, (int)$child['id_shop']);
$this->_menu .= '</ul>';
}
$this->_menu .= '</li>';
}
$this->_menu .= '</li>';
}
private function getCMSMenuItems($parent, $depth = 1, $id_lang = false)