How to Check a catagory is Anchored or non Anchored Programmatically in Magento 2Magento2 - Get category URL by IDCheck if subcategory exists in current categoryHow to check whether a product already exists or not in a category?How to check first level categories is available or not?How to check IsHomePage in Magento 2? Are we on the homepage?magento 2 : Remove catalog.leftnav from non anchored category pageMagento 2 - check if category have descriptionMagento2 : Check it is frontend or backend?How to check all child categories with their checked parent category?How to check setData() set the value or notMagento 2 - Best way to check if the current category is child

Group Integers by Originality

Union with anonymous struct with flexible array member

Is it expected that a reader will skip parts of what you write?

How did old MS-DOS games utilize various graphic cards?

Is it possible to have a wealthy country without a middle class?

Overlapping String-Blocks

Should I give professor gift at the beginning of my PhD?

Why would future John risk sending back a T-800 to save his younger self?

How do I prevent employees from either switching to competitors or opening their own business?

How can this tool find out registered domains from an IP?

Second (easy access) account in case my bank screws up

Why didn't Voldemort recognize that Dumbledore was affected by his curse?

Zeros of the Hadamard product of holomorphic functions

How can I end combat quickly when the outcome is inevitable?

Pathfinder warbow concept review

Non-disclosure agreement in a small business

Is using haveibeenpwned to validate password strength rational?

Is it legal for a bar bouncer to confiscate a fake ID

How to manually rewind film?

How can I make some of my chapters "come to life"?

Is a lack of character descriptions a problem?

How to hide rifle during medieval town entrance inspection?

Is an entry level DSLR going to shoot nice portrait pictures?

Wooden cooking layout



How to Check a catagory is Anchored or non Anchored Programmatically in Magento 2


Magento2 - Get category URL by IDCheck if subcategory exists in current categoryHow to check whether a product already exists or not in a category?How to check first level categories is available or not?How to check IsHomePage in Magento 2? Are we on the homepage?magento 2 : Remove catalog.leftnav from non anchored category pageMagento 2 - check if category have descriptionMagento2 : Check it is frontend or backend?How to check all child categories with their checked parent category?How to check setData() set the value or notMagento 2 - Best way to check if the current category is child






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I want to check whether my current category in Anchored in Magneto 2










share|improve this question
























  • please explain briefly what do you want to do exactly ?

    – Rk Rathod
    May 31 at 6:55











  • @RkRathod if want to check wethermy current catagory layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

    – Waqar Ali
    May 31 at 6:57











  • where you actually want to implement this thing?

    – Rutvee Sojitra
    May 31 at 7:07

















0















I want to check whether my current category in Anchored in Magneto 2










share|improve this question
























  • please explain briefly what do you want to do exactly ?

    – Rk Rathod
    May 31 at 6:55











  • @RkRathod if want to check wethermy current catagory layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

    – Waqar Ali
    May 31 at 6:57











  • where you actually want to implement this thing?

    – Rutvee Sojitra
    May 31 at 7:07













0












0








0








I want to check whether my current category in Anchored in Magneto 2










share|improve this question
















I want to check whether my current category in Anchored in Magneto 2







magento2 category magento-catalog






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 31 at 9:20









Muhammad Wasif

15311




15311










asked May 31 at 6:29









Waqar AliWaqar Ali

7411




7411












  • please explain briefly what do you want to do exactly ?

    – Rk Rathod
    May 31 at 6:55











  • @RkRathod if want to check wethermy current catagory layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

    – Waqar Ali
    May 31 at 6:57











  • where you actually want to implement this thing?

    – Rutvee Sojitra
    May 31 at 7:07

















  • please explain briefly what do you want to do exactly ?

    – Rk Rathod
    May 31 at 6:55











  • @RkRathod if want to check wethermy current catagory layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

    – Waqar Ali
    May 31 at 6:57











  • where you actually want to implement this thing?

    – Rutvee Sojitra
    May 31 at 7:07
















please explain briefly what do you want to do exactly ?

– Rk Rathod
May 31 at 6:55





please explain briefly what do you want to do exactly ?

– Rk Rathod
May 31 at 6:55













@RkRathod if want to check wethermy current catagory layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

– Waqar Ali
May 31 at 6:57





@RkRathod if want to check wethermy current catagory layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

– Waqar Ali
May 31 at 6:57













where you actually want to implement this thing?

– Rutvee Sojitra
May 31 at 7:07





where you actually want to implement this thing?

– Rutvee Sojitra
May 31 at 7:07










4 Answers
4






active

oldest

votes


















2














According to the comments and requriement mentioned you can try the below logic:
Through Objectmanager:



$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$xmlLayout = $objectManager->get(MagentoFrameworkAppView::class);
$loadedHandles = $xmlLayout->getLayout()->getUpdate()->getHandles();


Through class injection:



public function __construct(
MagentoFrameworkAppViewInterface $view
)
$this->view = $view;



Use the below code to get loaded handles:



$loadedHandles = $this->view->getLayout()->getUpdate()->getHandles();


For isAnchored you will get below:



Array
(
[0] => default
[1] => catalog_category_view
[2] => catalog_category_view_type_layered
[3] => catalog_category_view_type_layered_without_children
[4] => catalog_category_view_id_4
)


And for Non-Anchored you will get below:



Array
(
[0] => default
[1] => catalog_category_view
[2] => catalog_category_view_type_default
[3] => catalog_category_view_id_20
[4] => catalog_category_view_layout_update_680a89c63ad8009fef6e1a9900eab84e
)


You can now use php in_array function to check your logic.






share|improve this answer






























    2














    private $categoryRepository;

    public function __construct(
    MagentoCatalogModelCategoryRepository $categoryRepository
    )
    $this->categoryRepository = $categoryRepository;


    public function getCategoryAnchor()
    $categoryId = '15'; // your category id
    $category = $this->categoryRepository->get($categoryId);

    if ($category->getIsAnchor())
    // your custom code




    EDIT
    As per your requirements, i think you need to find out the current layout used for current category, so try the below code :



    If you are using .phtml file



    then use




    $block->getLayout()->getUpdate()->getPageLayout()




    If you are using block class




    $this->getLayout()->getUpdate()->getPageLayout()







    share|improve this answer

























    • if want to check wether layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

      – Waqar Ali
      May 31 at 6:48











    • what do you want to do exactly ?

      – Manashvi Birla
      May 31 at 6:50











    • i want to to check wether this catagory is anchored or not.. but i want this through its layout name i searched for a while and found that anchored categories load catalog_category_view_type_default layout how can i do this??

      – Waqar Ali
      May 31 at 6:52











    • check my edited answer, if it helps you

      – Manashvi Birla
      May 31 at 7:08


















    1














    Pass category ID as per your requirement :



    $categoryId = 17;
    $_objectManager = MagentoFrameworkAppObjectManager::getInstance();
    $object_manager = $_objectManager->create('MagentoCatalogModelCategory')->load($categoryId);

    echo "<pre>";
    print_r($object_manager->getData());


    Note : Use of objectManager is not good idea. Instead of this you can use DI.



    Check here




    1 = Is Anchor 0 = Not Anchor







    share|improve this answer























    • if want to check wether layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

      – Waqar Ali
      May 31 at 6:38












    • Dude its different question. You must have mentioned this in question.

      – Vivek
      May 31 at 6:44











    • should i post a different question??

      – Waqar Ali
      May 31 at 6:48


















    0














    You can check using MagentoCatalogModelCategoryFactory as follows:



    protected $_category;

    public function __construct(
    MagentoCatalogModelCategoryFactory $category
    )
    $this->_category = $category;


    public function execute()
    $category = $this->_category->create()->load($id);
    var_dump($category->getIsAnchor()); // string "0" or "1"






    share|improve this answer























    • if want to check wether layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

      – Waqar Ali
      May 31 at 6:49











    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%2f276812%2fhow-to-check-a-catagory-is-anchored-or-non-anchored-programmatically-in-magento%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    4 Answers
    4






    active

    oldest

    votes








    4 Answers
    4






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    According to the comments and requriement mentioned you can try the below logic:
    Through Objectmanager:



    $objectManager = MagentoFrameworkAppObjectManager::getInstance();
    $xmlLayout = $objectManager->get(MagentoFrameworkAppView::class);
    $loadedHandles = $xmlLayout->getLayout()->getUpdate()->getHandles();


    Through class injection:



    public function __construct(
    MagentoFrameworkAppViewInterface $view
    )
    $this->view = $view;



    Use the below code to get loaded handles:



    $loadedHandles = $this->view->getLayout()->getUpdate()->getHandles();


    For isAnchored you will get below:



    Array
    (
    [0] => default
    [1] => catalog_category_view
    [2] => catalog_category_view_type_layered
    [3] => catalog_category_view_type_layered_without_children
    [4] => catalog_category_view_id_4
    )


    And for Non-Anchored you will get below:



    Array
    (
    [0] => default
    [1] => catalog_category_view
    [2] => catalog_category_view_type_default
    [3] => catalog_category_view_id_20
    [4] => catalog_category_view_layout_update_680a89c63ad8009fef6e1a9900eab84e
    )


    You can now use php in_array function to check your logic.






    share|improve this answer



























      2














      According to the comments and requriement mentioned you can try the below logic:
      Through Objectmanager:



      $objectManager = MagentoFrameworkAppObjectManager::getInstance();
      $xmlLayout = $objectManager->get(MagentoFrameworkAppView::class);
      $loadedHandles = $xmlLayout->getLayout()->getUpdate()->getHandles();


      Through class injection:



      public function __construct(
      MagentoFrameworkAppViewInterface $view
      )
      $this->view = $view;



      Use the below code to get loaded handles:



      $loadedHandles = $this->view->getLayout()->getUpdate()->getHandles();


      For isAnchored you will get below:



      Array
      (
      [0] => default
      [1] => catalog_category_view
      [2] => catalog_category_view_type_layered
      [3] => catalog_category_view_type_layered_without_children
      [4] => catalog_category_view_id_4
      )


      And for Non-Anchored you will get below:



      Array
      (
      [0] => default
      [1] => catalog_category_view
      [2] => catalog_category_view_type_default
      [3] => catalog_category_view_id_20
      [4] => catalog_category_view_layout_update_680a89c63ad8009fef6e1a9900eab84e
      )


      You can now use php in_array function to check your logic.






      share|improve this answer

























        2












        2








        2







        According to the comments and requriement mentioned you can try the below logic:
        Through Objectmanager:



        $objectManager = MagentoFrameworkAppObjectManager::getInstance();
        $xmlLayout = $objectManager->get(MagentoFrameworkAppView::class);
        $loadedHandles = $xmlLayout->getLayout()->getUpdate()->getHandles();


        Through class injection:



        public function __construct(
        MagentoFrameworkAppViewInterface $view
        )
        $this->view = $view;



        Use the below code to get loaded handles:



        $loadedHandles = $this->view->getLayout()->getUpdate()->getHandles();


        For isAnchored you will get below:



        Array
        (
        [0] => default
        [1] => catalog_category_view
        [2] => catalog_category_view_type_layered
        [3] => catalog_category_view_type_layered_without_children
        [4] => catalog_category_view_id_4
        )


        And for Non-Anchored you will get below:



        Array
        (
        [0] => default
        [1] => catalog_category_view
        [2] => catalog_category_view_type_default
        [3] => catalog_category_view_id_20
        [4] => catalog_category_view_layout_update_680a89c63ad8009fef6e1a9900eab84e
        )


        You can now use php in_array function to check your logic.






        share|improve this answer













        According to the comments and requriement mentioned you can try the below logic:
        Through Objectmanager:



        $objectManager = MagentoFrameworkAppObjectManager::getInstance();
        $xmlLayout = $objectManager->get(MagentoFrameworkAppView::class);
        $loadedHandles = $xmlLayout->getLayout()->getUpdate()->getHandles();


        Through class injection:



        public function __construct(
        MagentoFrameworkAppViewInterface $view
        )
        $this->view = $view;



        Use the below code to get loaded handles:



        $loadedHandles = $this->view->getLayout()->getUpdate()->getHandles();


        For isAnchored you will get below:



        Array
        (
        [0] => default
        [1] => catalog_category_view
        [2] => catalog_category_view_type_layered
        [3] => catalog_category_view_type_layered_without_children
        [4] => catalog_category_view_id_4
        )


        And for Non-Anchored you will get below:



        Array
        (
        [0] => default
        [1] => catalog_category_view
        [2] => catalog_category_view_type_default
        [3] => catalog_category_view_id_20
        [4] => catalog_category_view_layout_update_680a89c63ad8009fef6e1a9900eab84e
        )


        You can now use php in_array function to check your logic.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered May 31 at 7:43









        Sukumar GoraiSukumar Gorai

        7,3383730




        7,3383730























            2














            private $categoryRepository;

            public function __construct(
            MagentoCatalogModelCategoryRepository $categoryRepository
            )
            $this->categoryRepository = $categoryRepository;


            public function getCategoryAnchor()
            $categoryId = '15'; // your category id
            $category = $this->categoryRepository->get($categoryId);

            if ($category->getIsAnchor())
            // your custom code




            EDIT
            As per your requirements, i think you need to find out the current layout used for current category, so try the below code :



            If you are using .phtml file



            then use




            $block->getLayout()->getUpdate()->getPageLayout()




            If you are using block class




            $this->getLayout()->getUpdate()->getPageLayout()







            share|improve this answer

























            • if want to check wether layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

              – Waqar Ali
              May 31 at 6:48











            • what do you want to do exactly ?

              – Manashvi Birla
              May 31 at 6:50











            • i want to to check wether this catagory is anchored or not.. but i want this through its layout name i searched for a while and found that anchored categories load catalog_category_view_type_default layout how can i do this??

              – Waqar Ali
              May 31 at 6:52











            • check my edited answer, if it helps you

              – Manashvi Birla
              May 31 at 7:08















            2














            private $categoryRepository;

            public function __construct(
            MagentoCatalogModelCategoryRepository $categoryRepository
            )
            $this->categoryRepository = $categoryRepository;


            public function getCategoryAnchor()
            $categoryId = '15'; // your category id
            $category = $this->categoryRepository->get($categoryId);

            if ($category->getIsAnchor())
            // your custom code




            EDIT
            As per your requirements, i think you need to find out the current layout used for current category, so try the below code :



            If you are using .phtml file



            then use




            $block->getLayout()->getUpdate()->getPageLayout()




            If you are using block class




            $this->getLayout()->getUpdate()->getPageLayout()







            share|improve this answer

























            • if want to check wether layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

              – Waqar Ali
              May 31 at 6:48











            • what do you want to do exactly ?

              – Manashvi Birla
              May 31 at 6:50











            • i want to to check wether this catagory is anchored or not.. but i want this through its layout name i searched for a while and found that anchored categories load catalog_category_view_type_default layout how can i do this??

              – Waqar Ali
              May 31 at 6:52











            • check my edited answer, if it helps you

              – Manashvi Birla
              May 31 at 7:08













            2












            2








            2







            private $categoryRepository;

            public function __construct(
            MagentoCatalogModelCategoryRepository $categoryRepository
            )
            $this->categoryRepository = $categoryRepository;


            public function getCategoryAnchor()
            $categoryId = '15'; // your category id
            $category = $this->categoryRepository->get($categoryId);

            if ($category->getIsAnchor())
            // your custom code




            EDIT
            As per your requirements, i think you need to find out the current layout used for current category, so try the below code :



            If you are using .phtml file



            then use




            $block->getLayout()->getUpdate()->getPageLayout()




            If you are using block class




            $this->getLayout()->getUpdate()->getPageLayout()







            share|improve this answer















            private $categoryRepository;

            public function __construct(
            MagentoCatalogModelCategoryRepository $categoryRepository
            )
            $this->categoryRepository = $categoryRepository;


            public function getCategoryAnchor()
            $categoryId = '15'; // your category id
            $category = $this->categoryRepository->get($categoryId);

            if ($category->getIsAnchor())
            // your custom code




            EDIT
            As per your requirements, i think you need to find out the current layout used for current category, so try the below code :



            If you are using .phtml file



            then use




            $block->getLayout()->getUpdate()->getPageLayout()




            If you are using block class




            $this->getLayout()->getUpdate()->getPageLayout()








            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited May 31 at 7:08

























            answered May 31 at 6:43









            Manashvi BirlaManashvi Birla

            6,69761941




            6,69761941












            • if want to check wether layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

              – Waqar Ali
              May 31 at 6:48











            • what do you want to do exactly ?

              – Manashvi Birla
              May 31 at 6:50











            • i want to to check wether this catagory is anchored or not.. but i want this through its layout name i searched for a while and found that anchored categories load catalog_category_view_type_default layout how can i do this??

              – Waqar Ali
              May 31 at 6:52











            • check my edited answer, if it helps you

              – Manashvi Birla
              May 31 at 7:08

















            • if want to check wether layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

              – Waqar Ali
              May 31 at 6:48











            • what do you want to do exactly ?

              – Manashvi Birla
              May 31 at 6:50











            • i want to to check wether this catagory is anchored or not.. but i want this through its layout name i searched for a while and found that anchored categories load catalog_category_view_type_default layout how can i do this??

              – Waqar Ali
              May 31 at 6:52











            • check my edited answer, if it helps you

              – Manashvi Birla
              May 31 at 7:08
















            if want to check wether layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

            – Waqar Ali
            May 31 at 6:48





            if want to check wether layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

            – Waqar Ali
            May 31 at 6:48













            what do you want to do exactly ?

            – Manashvi Birla
            May 31 at 6:50





            what do you want to do exactly ?

            – Manashvi Birla
            May 31 at 6:50













            i want to to check wether this catagory is anchored or not.. but i want this through its layout name i searched for a while and found that anchored categories load catalog_category_view_type_default layout how can i do this??

            – Waqar Ali
            May 31 at 6:52





            i want to to check wether this catagory is anchored or not.. but i want this through its layout name i searched for a while and found that anchored categories load catalog_category_view_type_default layout how can i do this??

            – Waqar Ali
            May 31 at 6:52













            check my edited answer, if it helps you

            – Manashvi Birla
            May 31 at 7:08





            check my edited answer, if it helps you

            – Manashvi Birla
            May 31 at 7:08











            1














            Pass category ID as per your requirement :



            $categoryId = 17;
            $_objectManager = MagentoFrameworkAppObjectManager::getInstance();
            $object_manager = $_objectManager->create('MagentoCatalogModelCategory')->load($categoryId);

            echo "<pre>";
            print_r($object_manager->getData());


            Note : Use of objectManager is not good idea. Instead of this you can use DI.



            Check here




            1 = Is Anchor 0 = Not Anchor







            share|improve this answer























            • if want to check wether layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

              – Waqar Ali
              May 31 at 6:38












            • Dude its different question. You must have mentioned this in question.

              – Vivek
              May 31 at 6:44











            • should i post a different question??

              – Waqar Ali
              May 31 at 6:48















            1














            Pass category ID as per your requirement :



            $categoryId = 17;
            $_objectManager = MagentoFrameworkAppObjectManager::getInstance();
            $object_manager = $_objectManager->create('MagentoCatalogModelCategory')->load($categoryId);

            echo "<pre>";
            print_r($object_manager->getData());


            Note : Use of objectManager is not good idea. Instead of this you can use DI.



            Check here




            1 = Is Anchor 0 = Not Anchor







            share|improve this answer























            • if want to check wether layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

              – Waqar Ali
              May 31 at 6:38












            • Dude its different question. You must have mentioned this in question.

              – Vivek
              May 31 at 6:44











            • should i post a different question??

              – Waqar Ali
              May 31 at 6:48













            1












            1








            1







            Pass category ID as per your requirement :



            $categoryId = 17;
            $_objectManager = MagentoFrameworkAppObjectManager::getInstance();
            $object_manager = $_objectManager->create('MagentoCatalogModelCategory')->load($categoryId);

            echo "<pre>";
            print_r($object_manager->getData());


            Note : Use of objectManager is not good idea. Instead of this you can use DI.



            Check here




            1 = Is Anchor 0 = Not Anchor







            share|improve this answer













            Pass category ID as per your requirement :



            $categoryId = 17;
            $_objectManager = MagentoFrameworkAppObjectManager::getInstance();
            $object_manager = $_objectManager->create('MagentoCatalogModelCategory')->load($categoryId);

            echo "<pre>";
            print_r($object_manager->getData());


            Note : Use of objectManager is not good idea. Instead of this you can use DI.



            Check here




            1 = Is Anchor 0 = Not Anchor








            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered May 31 at 6:35









            VivekVivek

            1,8561836




            1,8561836












            • if want to check wether layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

              – Waqar Ali
              May 31 at 6:38












            • Dude its different question. You must have mentioned this in question.

              – Vivek
              May 31 at 6:44











            • should i post a different question??

              – Waqar Ali
              May 31 at 6:48

















            • if want to check wether layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

              – Waqar Ali
              May 31 at 6:38












            • Dude its different question. You must have mentioned this in question.

              – Vivek
              May 31 at 6:44











            • should i post a different question??

              – Waqar Ali
              May 31 at 6:48
















            if want to check wether layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

            – Waqar Ali
            May 31 at 6:38






            if want to check wether layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

            – Waqar Ali
            May 31 at 6:38














            Dude its different question. You must have mentioned this in question.

            – Vivek
            May 31 at 6:44





            Dude its different question. You must have mentioned this in question.

            – Vivek
            May 31 at 6:44













            should i post a different question??

            – Waqar Ali
            May 31 at 6:48





            should i post a different question??

            – Waqar Ali
            May 31 at 6:48











            0














            You can check using MagentoCatalogModelCategoryFactory as follows:



            protected $_category;

            public function __construct(
            MagentoCatalogModelCategoryFactory $category
            )
            $this->_category = $category;


            public function execute()
            $category = $this->_category->create()->load($id);
            var_dump($category->getIsAnchor()); // string "0" or "1"






            share|improve this answer























            • if want to check wether layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

              – Waqar Ali
              May 31 at 6:49















            0














            You can check using MagentoCatalogModelCategoryFactory as follows:



            protected $_category;

            public function __construct(
            MagentoCatalogModelCategoryFactory $category
            )
            $this->_category = $category;


            public function execute()
            $category = $this->_category->create()->load($id);
            var_dump($category->getIsAnchor()); // string "0" or "1"






            share|improve this answer























            • if want to check wether layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

              – Waqar Ali
              May 31 at 6:49













            0












            0








            0







            You can check using MagentoCatalogModelCategoryFactory as follows:



            protected $_category;

            public function __construct(
            MagentoCatalogModelCategoryFactory $category
            )
            $this->_category = $category;


            public function execute()
            $category = $this->_category->create()->load($id);
            var_dump($category->getIsAnchor()); // string "0" or "1"






            share|improve this answer













            You can check using MagentoCatalogModelCategoryFactory as follows:



            protected $_category;

            public function __construct(
            MagentoCatalogModelCategoryFactory $category
            )
            $this->_category = $category;


            public function execute()
            $category = $this->_category->create()->load($id);
            var_dump($category->getIsAnchor()); // string "0" or "1"







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered May 31 at 6:45









            Dhara BhattiDhara Bhatti

            435112




            435112












            • if want to check wether layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

              – Waqar Ali
              May 31 at 6:49

















            • if want to check wether layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

              – Waqar Ali
              May 31 at 6:49
















            if want to check wether layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

            – Waqar Ali
            May 31 at 6:49





            if want to check wether layout in catalog_category_view_type_default or catalog_category_view_type_default_without_children

            – Waqar Ali
            May 31 at 6:49

















            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f276812%2fhow-to-check-a-catagory-is-anchored-or-non-anchored-programmatically-in-magento%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

            Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

            Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

            Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?