Include in Menu false but still subcategory is showing using Magento2












0














I want to hide some submenus from the Menu by using "Include in Menu = false" from the admin panel, but still, it's showing in Menu. please update if there is any solution to this.










share|improve this question






















  • Did you clear the cache?
    – Shireen N
    Mar 12 '18 at 13:22










  • yes i have used command php bin/magento cache:clean
    – Gaurav kakkar
    Mar 12 '18 at 13:35










  • also used php bin/magento cache:flush
    – Gaurav kakkar
    Mar 12 '18 at 13:36










  • Is there is any way to do this from the core file, if yes please assist me how could I do that?
    – Gaurav kakkar
    Mar 12 '18 at 13:43










  • Do you want to do it programmatically?If so are you using any csv to import the categories?
    – Shireen N
    Mar 12 '18 at 13:53
















0














I want to hide some submenus from the Menu by using "Include in Menu = false" from the admin panel, but still, it's showing in Menu. please update if there is any solution to this.










share|improve this question






















  • Did you clear the cache?
    – Shireen N
    Mar 12 '18 at 13:22










  • yes i have used command php bin/magento cache:clean
    – Gaurav kakkar
    Mar 12 '18 at 13:35










  • also used php bin/magento cache:flush
    – Gaurav kakkar
    Mar 12 '18 at 13:36










  • Is there is any way to do this from the core file, if yes please assist me how could I do that?
    – Gaurav kakkar
    Mar 12 '18 at 13:43










  • Do you want to do it programmatically?If so are you using any csv to import the categories?
    – Shireen N
    Mar 12 '18 at 13:53














0












0








0







I want to hide some submenus from the Menu by using "Include in Menu = false" from the admin panel, but still, it's showing in Menu. please update if there is any solution to this.










share|improve this question













I want to hide some submenus from the Menu by using "Include in Menu = false" from the admin panel, but still, it's showing in Menu. please update if there is any solution to this.







magento2






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 12 '18 at 13:18









Gaurav kakkarGaurav kakkar

12




12












  • Did you clear the cache?
    – Shireen N
    Mar 12 '18 at 13:22










  • yes i have used command php bin/magento cache:clean
    – Gaurav kakkar
    Mar 12 '18 at 13:35










  • also used php bin/magento cache:flush
    – Gaurav kakkar
    Mar 12 '18 at 13:36










  • Is there is any way to do this from the core file, if yes please assist me how could I do that?
    – Gaurav kakkar
    Mar 12 '18 at 13:43










  • Do you want to do it programmatically?If so are you using any csv to import the categories?
    – Shireen N
    Mar 12 '18 at 13:53


















  • Did you clear the cache?
    – Shireen N
    Mar 12 '18 at 13:22










  • yes i have used command php bin/magento cache:clean
    – Gaurav kakkar
    Mar 12 '18 at 13:35










  • also used php bin/magento cache:flush
    – Gaurav kakkar
    Mar 12 '18 at 13:36










  • Is there is any way to do this from the core file, if yes please assist me how could I do that?
    – Gaurav kakkar
    Mar 12 '18 at 13:43










  • Do you want to do it programmatically?If so are you using any csv to import the categories?
    – Shireen N
    Mar 12 '18 at 13:53
















Did you clear the cache?
– Shireen N
Mar 12 '18 at 13:22




Did you clear the cache?
– Shireen N
Mar 12 '18 at 13:22












yes i have used command php bin/magento cache:clean
– Gaurav kakkar
Mar 12 '18 at 13:35




yes i have used command php bin/magento cache:clean
– Gaurav kakkar
Mar 12 '18 at 13:35












also used php bin/magento cache:flush
– Gaurav kakkar
Mar 12 '18 at 13:36




also used php bin/magento cache:flush
– Gaurav kakkar
Mar 12 '18 at 13:36












Is there is any way to do this from the core file, if yes please assist me how could I do that?
– Gaurav kakkar
Mar 12 '18 at 13:43




Is there is any way to do this from the core file, if yes please assist me how could I do that?
– Gaurav kakkar
Mar 12 '18 at 13:43












Do you want to do it programmatically?If so are you using any csv to import the categories?
– Shireen N
Mar 12 '18 at 13:53




Do you want to do it programmatically?If so are you using any csv to import the categories?
– Shireen N
Mar 12 '18 at 13:53










2 Answers
2






active

oldest

votes


















0














How to create a hidden category?



You need to follow these steps.
1. Choose the Categories section into Product section on Admin sidebar to start configuration.
2. Select the category you want to hide in the category tree.
3. Then you must edit some field in General Information and Display Setting like this:
General Information: Set Is Active and Include in Navigation Menu to No
Display setting: Set Is Anchor to No

Just with these simple steps, you can hide a category.
When you complete the configuration, tap Save Category.





share|improve this answer





























    0














    Try to use this script :



     <?php
    $objectManager = MagentoFrameworkAppObjectManager::getInstance();
    $categoryCollection = $objectManager->get('MagentoCatalogModelResourceModelCategoryCollectionFactory');
    $categories = $categoryCollection->create();
    $categories->addAttributeToSelect('*');
    $categories->addAttributeToFilter('level', array('eq'=>2));
    $categories->load();
    ?>
    <?php
    foreach($categories as $category):
    $catId = $category->getId();
    $subcategory = $objectManager->create('MagentoCatalogModelCategory')->load($catId);
    $subcats = $subcategory->getChildrenCategories();
    $_helper = $this->helper('MagentoCatalogHelperOutput');
    foreach ($subcats as $subcat) {
    $_category = $objectManager->create('MagentoCatalogModelCategory')->load($subcat->getId());
    $_outputhelper = $this->helper('MagentoCatalogHelperOutput');
    $storeManager = $objectManager->get('MagentoStoreModelStoreManagerInterface');
    $sitebaseurl = $storeManager->getStore()->getBaseUrl();
    $subcaturl = $subcat->getUrl();
    if (!$_category->getData('include_in_menu')) {

    continue;

    }
    ?>
    <a href="<?php echo $subcat->getUrl(); ?>" id="sub_<?php echo $subcat->getId();?>" class="<?php if($subcat->getChildrenCategories()->count()):?>child_sub<?php else:?> no-child<?php endif;?>">
    <?php echo $subcat->getName(); ?>
    </a>
    <?php } ?>
    <?php endforeach; ?>





    share|improve this answer























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "479"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f216995%2finclude-in-menu-false-but-still-subcategory-is-showing-using-magento2%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      How to create a hidden category?



      You need to follow these steps.
      1. Choose the Categories section into Product section on Admin sidebar to start configuration.
      2. Select the category you want to hide in the category tree.
      3. Then you must edit some field in General Information and Display Setting like this:
      General Information: Set Is Active and Include in Navigation Menu to No
      Display setting: Set Is Anchor to No

      Just with these simple steps, you can hide a category.
      When you complete the configuration, tap Save Category.





      share|improve this answer


























        0














        How to create a hidden category?



        You need to follow these steps.
        1. Choose the Categories section into Product section on Admin sidebar to start configuration.
        2. Select the category you want to hide in the category tree.
        3. Then you must edit some field in General Information and Display Setting like this:
        General Information: Set Is Active and Include in Navigation Menu to No
        Display setting: Set Is Anchor to No

        Just with these simple steps, you can hide a category.
        When you complete the configuration, tap Save Category.





        share|improve this answer
























          0












          0








          0






          How to create a hidden category?



          You need to follow these steps.
          1. Choose the Categories section into Product section on Admin sidebar to start configuration.
          2. Select the category you want to hide in the category tree.
          3. Then you must edit some field in General Information and Display Setting like this:
          General Information: Set Is Active and Include in Navigation Menu to No
          Display setting: Set Is Anchor to No

          Just with these simple steps, you can hide a category.
          When you complete the configuration, tap Save Category.





          share|improve this answer












          How to create a hidden category?



          You need to follow these steps.
          1. Choose the Categories section into Product section on Admin sidebar to start configuration.
          2. Select the category you want to hide in the category tree.
          3. Then you must edit some field in General Information and Display Setting like this:
          General Information: Set Is Active and Include in Navigation Menu to No
          Display setting: Set Is Anchor to No

          Just with these simple steps, you can hide a category.
          When you complete the configuration, tap Save Category.






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 12 '18 at 13:42









          Shireen NShireen N

          662411




          662411

























              0














              Try to use this script :



               <?php
              $objectManager = MagentoFrameworkAppObjectManager::getInstance();
              $categoryCollection = $objectManager->get('MagentoCatalogModelResourceModelCategoryCollectionFactory');
              $categories = $categoryCollection->create();
              $categories->addAttributeToSelect('*');
              $categories->addAttributeToFilter('level', array('eq'=>2));
              $categories->load();
              ?>
              <?php
              foreach($categories as $category):
              $catId = $category->getId();
              $subcategory = $objectManager->create('MagentoCatalogModelCategory')->load($catId);
              $subcats = $subcategory->getChildrenCategories();
              $_helper = $this->helper('MagentoCatalogHelperOutput');
              foreach ($subcats as $subcat) {
              $_category = $objectManager->create('MagentoCatalogModelCategory')->load($subcat->getId());
              $_outputhelper = $this->helper('MagentoCatalogHelperOutput');
              $storeManager = $objectManager->get('MagentoStoreModelStoreManagerInterface');
              $sitebaseurl = $storeManager->getStore()->getBaseUrl();
              $subcaturl = $subcat->getUrl();
              if (!$_category->getData('include_in_menu')) {

              continue;

              }
              ?>
              <a href="<?php echo $subcat->getUrl(); ?>" id="sub_<?php echo $subcat->getId();?>" class="<?php if($subcat->getChildrenCategories()->count()):?>child_sub<?php else:?> no-child<?php endif;?>">
              <?php echo $subcat->getName(); ?>
              </a>
              <?php } ?>
              <?php endforeach; ?>





              share|improve this answer




























                0














                Try to use this script :



                 <?php
                $objectManager = MagentoFrameworkAppObjectManager::getInstance();
                $categoryCollection = $objectManager->get('MagentoCatalogModelResourceModelCategoryCollectionFactory');
                $categories = $categoryCollection->create();
                $categories->addAttributeToSelect('*');
                $categories->addAttributeToFilter('level', array('eq'=>2));
                $categories->load();
                ?>
                <?php
                foreach($categories as $category):
                $catId = $category->getId();
                $subcategory = $objectManager->create('MagentoCatalogModelCategory')->load($catId);
                $subcats = $subcategory->getChildrenCategories();
                $_helper = $this->helper('MagentoCatalogHelperOutput');
                foreach ($subcats as $subcat) {
                $_category = $objectManager->create('MagentoCatalogModelCategory')->load($subcat->getId());
                $_outputhelper = $this->helper('MagentoCatalogHelperOutput');
                $storeManager = $objectManager->get('MagentoStoreModelStoreManagerInterface');
                $sitebaseurl = $storeManager->getStore()->getBaseUrl();
                $subcaturl = $subcat->getUrl();
                if (!$_category->getData('include_in_menu')) {

                continue;

                }
                ?>
                <a href="<?php echo $subcat->getUrl(); ?>" id="sub_<?php echo $subcat->getId();?>" class="<?php if($subcat->getChildrenCategories()->count()):?>child_sub<?php else:?> no-child<?php endif;?>">
                <?php echo $subcat->getName(); ?>
                </a>
                <?php } ?>
                <?php endforeach; ?>





                share|improve this answer


























                  0












                  0








                  0






                  Try to use this script :



                   <?php
                  $objectManager = MagentoFrameworkAppObjectManager::getInstance();
                  $categoryCollection = $objectManager->get('MagentoCatalogModelResourceModelCategoryCollectionFactory');
                  $categories = $categoryCollection->create();
                  $categories->addAttributeToSelect('*');
                  $categories->addAttributeToFilter('level', array('eq'=>2));
                  $categories->load();
                  ?>
                  <?php
                  foreach($categories as $category):
                  $catId = $category->getId();
                  $subcategory = $objectManager->create('MagentoCatalogModelCategory')->load($catId);
                  $subcats = $subcategory->getChildrenCategories();
                  $_helper = $this->helper('MagentoCatalogHelperOutput');
                  foreach ($subcats as $subcat) {
                  $_category = $objectManager->create('MagentoCatalogModelCategory')->load($subcat->getId());
                  $_outputhelper = $this->helper('MagentoCatalogHelperOutput');
                  $storeManager = $objectManager->get('MagentoStoreModelStoreManagerInterface');
                  $sitebaseurl = $storeManager->getStore()->getBaseUrl();
                  $subcaturl = $subcat->getUrl();
                  if (!$_category->getData('include_in_menu')) {

                  continue;

                  }
                  ?>
                  <a href="<?php echo $subcat->getUrl(); ?>" id="sub_<?php echo $subcat->getId();?>" class="<?php if($subcat->getChildrenCategories()->count()):?>child_sub<?php else:?> no-child<?php endif;?>">
                  <?php echo $subcat->getName(); ?>
                  </a>
                  <?php } ?>
                  <?php endforeach; ?>





                  share|improve this answer














                  Try to use this script :



                   <?php
                  $objectManager = MagentoFrameworkAppObjectManager::getInstance();
                  $categoryCollection = $objectManager->get('MagentoCatalogModelResourceModelCategoryCollectionFactory');
                  $categories = $categoryCollection->create();
                  $categories->addAttributeToSelect('*');
                  $categories->addAttributeToFilter('level', array('eq'=>2));
                  $categories->load();
                  ?>
                  <?php
                  foreach($categories as $category):
                  $catId = $category->getId();
                  $subcategory = $objectManager->create('MagentoCatalogModelCategory')->load($catId);
                  $subcats = $subcategory->getChildrenCategories();
                  $_helper = $this->helper('MagentoCatalogHelperOutput');
                  foreach ($subcats as $subcat) {
                  $_category = $objectManager->create('MagentoCatalogModelCategory')->load($subcat->getId());
                  $_outputhelper = $this->helper('MagentoCatalogHelperOutput');
                  $storeManager = $objectManager->get('MagentoStoreModelStoreManagerInterface');
                  $sitebaseurl = $storeManager->getStore()->getBaseUrl();
                  $subcaturl = $subcat->getUrl();
                  if (!$_category->getData('include_in_menu')) {

                  continue;

                  }
                  ?>
                  <a href="<?php echo $subcat->getUrl(); ?>" id="sub_<?php echo $subcat->getId();?>" class="<?php if($subcat->getChildrenCategories()->count()):?>child_sub<?php else:?> no-child<?php endif;?>">
                  <?php echo $subcat->getName(); ?>
                  </a>
                  <?php } ?>
                  <?php endforeach; ?>






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited yesterday









                  Ylgen Guxholli

                  763315




                  763315










                  answered Nov 23 '18 at 7:53









                  AB SaiyadAB Saiyad

                  494




                  494






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Magento Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f216995%2finclude-in-menu-false-but-still-subcategory-is-showing-using-magento2%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      An IMO inspired problem

                      Management

                      Investment