Jump to content

Prestashop : limiter l’arborescence du top menu


Recommended Posts

Bonjour,

J'ai besoin de mettre le sous menu a un niveau

donc, j'ai trouvé un tutoriel sur le net que j'ai mis en application, or il ne fonctionne pas.

 

    protected function generateCategoriesMenu($categories, $is_children = 0)
    {
        $html = '';

        foreach ($categories as $key => $category) {
            if ($category['level_depth'] > 3)  return false   {
                $cat = new Category($category['id_category']);
                $link = Tools::HtmlEntitiesUTF8($cat->getLink());
            } else {
                $link = $this->context->link->getPageLink('index');
            }

 

 

cela m'indique que j'ai le else en trop, donc, je fait.

 

    protected function generateCategoriesMenu($categories, $is_children = 0)
    {
        $html = '';

        foreach ($categories as $key => $category) {
            if ($category['level_depth'] > 3)  return false   {
                $cat = new Category($category['id_category']);
                $link = Tools::HtmlEntitiesUTF8($cat->getLink());

 

 

et cela ne fonctionne toujours pas.

Comment, je peux faire ?

 

 

Link to comment
Share on other sites

 

    protected function generateCategoriesMenu($categories, $is_children = 0)
    {
        $html = '';

        foreach ($categories as $key => $category) {
            if ($category['level_depth'] > 3)  return false   {
                $cat = new Category($category['id_category']);
                $link = Tools::HtmlEntitiesUTF8($cat->getLink());

 

 

et cela ne fonctionne toujours pas.

Comment, je peux faire ?

foreach ($categories as $key => $category) 
{
            if ($category['level_depth'] > 3)
            {
                $cat = new Category($category['id_category']);
                $link = Tools::HtmlEntitiesUTF8($cat->getLink());
            }
            else
            {
                $link = $this->context->link->getPageLink('index');
            }
}
Edited by Bakhouche Akram (see edit history)
Link to comment
Share on other sites

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...