Jump to content

Top menu edit <li>


Recommended Posts

blocktopmenu.php

 

check this code:

private function getCategory($id_category, $id_lang = false, $id_shop = false)
{
 $id_lang = $id_lang ? (int)$id_lang : (int)Context::getContext()->language->id;
 $category = new Category((int)$id_category, (int)$id_lang);
 if ($category->level_depth > 1)
  $category_link = $category->getLink();
 else
  $category_link = $this->context->link->getPageLink('index');
 if (is_null($category->id))
  return;
 $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"' : '';
 $is_intersected = array_intersect($category->getGroups(), $this->user_groups);
 // filter the categories that the user is allowed to see and browse
 if (!empty($is_intersected))
 {
  $this->_menu .= '<li '.$selected.'>';
  $this->_menu .= '<a href="'.$category_link.'">'.$category->name.'</a>';
  if (count($children))
  {
   $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>';
 }
}

Link to comment
Share on other sites

×
×
  • Create New...