Trouble with my php prestashop conditionnal code

Hello,
I’m having trouble with my prestashop code. I want to disable a link in my menu for one of my item from category 5. I don’t see where the proble, is…
Here is the code : [php]
private function getCategory($id_category, $id_lang)
{
global $page_name;

$categorie = new Category($id_category, $id_lang);
if(is_null($categorie->id))
  return;
$selected = ($page_name == 'category' && ((int)Tools::getValue('id_category') == $id_category)) ? ' class="sfHoverForce"' : '';
$this->_menu .= '<li'.$selected.'>';
if(count(explode('.', $categorie->name)) > 1)
  $name = str_replace('.', '', strstr($categorie->name, '.'));

elseif($categorie->id==5)

$name = $categorie->name;
$this->_menu .= '<a href="#">'.$name.'</a>';
$childrens = Category::getChildren($id_category, $id_lang);
if(count($childrens))
{
  $this->_menu .= '<ul>';
  foreach($childrens as $children)
    $this->getCategory($children['id_category'], $id_lang);
  $this->_menu .= '</ul>';

$this->_menu .= '</li>';
}
else
  $name = $categorie->name;
$this->_menu .= '<a href="'.$categorie->getLink().'">'.$name.'</a>';
$childrens = Category::getChildren($id_category, $id_lang);
if(count($childrens))
{
  $this->_menu .= '<ul>';
  foreach($childrens as $children)
    $this->getCategory($children['id_category'], $id_lang);
  $this->_menu .= '</ul>';
}
$this->_menu .= '</li>';

}
[/php]

Any advice ?
Thank you very much,
Tiwelle

Why not just do it from the admin panel or delete it from the database?

Hi,
You should the move the menu from database. Use phpmyadmin or another tool to edit your database, select ps_tab and then delete the record you want:

Here i wrote a Prestashop tutorial about how to remove a Prestashop BO’s menu:
https://www.prestasoo.com/blog/how-to-remove-prestashop-theme-catalog-menu.html.

Stop necro posting. After 6 years, whatever has to be said is irrelevant.

Sponsor our Newsletter | Privacy Policy | Terms of Service