Jump to content

CMS subcategory on horizontal menu


phm2000

Recommended Posts

Hello

 

On menu, I inser a cms category witch contain cms subcategory and pages. It look like this.

  • cms category link ok
    • cms sub category no link (only #)
      • page 1 link ok
      • page 2 link ok

My cms subcategory appears but without link to itself. When I click on a page I can see the link to cms subcategory on the breadcrumbs.

 

My question : how can I modifiy the blocktomenu.php file in the folder modules/blocktopmenu to create the missing link.

 

I found the code where it seems to be but I don't know how to modify it.

 

It begins at line 660, I suppose I have to modify the lines after : foreach ($categories as $category)

 

 private function getCMSMenuItems($parent, $depth = 1, $id_lang = false)
{
 $id_lang = $id_lang ? (int)$id_lang : (int)Context::getContext()->language->id;
 if ($depth > 3)
  return;
 $categories = $this->getCMSCategories(false, (int)$parent, (int)$id_lang);
 $pages = $this->getCMSPages((int)$parent);
 if (count($categories) || count($pages))
 {
  $this->_menu .= '<ul>';
  foreach ($categories as $category)
  {
$this->_menu .= '<li>';
$this->_menu .= '<a href="#">'.$category['name'].'</a>';
$this->getCMSMenuItems($category['id_cms_category'], (int)$depth + 1);
$this->_menu .= '</li>';
  }
  foreach ($pages as $page)
  {
$cms = new CMS($page['id_cms'], (int)$id_lang);
$links = $cms->getLinks((int)$id_lang, array((int)$cms->id));
$selected = ($this->page_name == 'cms' && ((int)Tools::getValue('id_cms') == $page['id_cms'])) ? ' class="sfHoverForce"' : '';
$this->_menu .= '<li '.$selected.'>';
$this->_menu .= '<a href="'.$links[0]['link'].'">'.$cms->meta_title.'</a>';
$this->_menu .= '</li>';
  }
  $this->_menu .= '</ul>';
 }
}

 

Can someone help me please.

 

Prestashop 1.5.4.1

Link to comment
Share on other sites

  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...