Jump to content

PrestaShop 1.7.6.8 - Theme Classic - Top Menu - Limit Category Levels to Show - FIXED


Recommended Posts

Hello!
In the Top Menu I needed to limit the Categories detail level to 1, and I found solutions only for prior versions of my PrestaShop version.
I'm no expert coder at all, so please be kind... may be I performed major surgery instead being a bit more gentle 🙃

-- PS ver 1.7.6.8
-- Theme: Classic 1.0.0
-- File: modules/ps_mainmenu/ps_mainmenu.php
-- Line 715  protected function "generateCategoriesMenu"
-- Disabled (commented) lines 746 to 761 as follows

            /*if (isset($category['children']) && !empty($category['children'])) {
                $node['children'] = $this->generateCategoriesMenu($category['children'], 1);

                if ($this->imageFiles === null) {
                    $this->imageFiles = scandir(_PS_CAT_IMG_DIR_);
                }

                if (count(preg_grep('/^'.$category['id_category'].'-([0-9])?_thumb.jpg/i', $this->imageFiles)) > 0) {
                    foreach ($this->imageFiles as $file) {
                        if (preg_match('/^'.$category['id_category'].'-([0-9])?_thumb.jpg/i', $file) === 1) {
                            $image_url = $this->context->link->getMediaLink(_THEME_CAT_DIR_.$file);
                            $node['image_urls'][] = $image_url;
                        }
                    }
                }
            }*/
-- Advanced Parameters, Performance, Smarty -> Save

image.png

-- Just in case, hit "Clear Cache" top right button
-- Tested, Worked for me!

Hope this can help.
Bye.

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