how to active/deactive a module for each store by admin in magento 2.2 Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar ManaraEnable 'Use in Advanced Search' option of product attribute for only one multi-siteHow to disable Magento 2 reviewsStore level User Permission In Magento BackendMagento 2: How to disable Minify CSS JS setting?Magento 2 - Create Admin Grid and show Custom Module list with Enable/Disable optionMagento 2 admin is not working after disable Magento_ThemeMagento 2.2 Open Source restrictions on each settingHow to disable magento 2 extension in store view (multistore)Have a option to enable/disable the module. I need to load admin page css when my module is enabled. No need to load css while module is disableHow to setup different Advanced Inventory Options for each store?

Does Mathematica have an implementation of the Poisson Binomial Distribution?

Justification for leaving new position after a short time

Protagonist's race is hidden - should I reveal it?

My bank got bought out, am I now going to have to start filing tax returns in a different state?

What *exactly* is electrical current, voltage, and resistance?

Align column where each cell has two decimals with siunitx

std::is_constructible on incomplete types

How do I check if a string is entirely made of the same substring?

How to keep bees out of canned beverages?

Multiple fireplaces in an apartment building?

Are all CP/M-80 implementations binary compatible?

What is the ongoing value of the Kanban board to the developers as opposed to management

Would reducing the reference voltage of an ADC have any effect on accuracy?

Why did C use the -> operator instead of reusing the . operator?

Book with legacy programming code on a space ship that the main character hacks to escape

What do you call the part of a novel that is not dialog?

What is it called when you ride around on your front wheel?

Is Electric Central Heating worth it if using Solar Panels?

Does Feeblemind produce an ongoing magical effect that can be dispelled?

How to open locks without disable device?

Where did Arya get these scars?

Why does the Cisco show run command not show the full version, while the show version command does?

Passing args from the bash script to the function in the script

Can you stand up from being prone using Skirmisher outside of your turn?



how to active/deactive a module for each store by admin in magento 2.2



Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar ManaraEnable 'Use in Advanced Search' option of product attribute for only one multi-siteHow to disable Magento 2 reviewsStore level User Permission In Magento BackendMagento 2: How to disable Minify CSS JS setting?Magento 2 - Create Admin Grid and show Custom Module list with Enable/Disable optionMagento 2 admin is not working after disable Magento_ThemeMagento 2.2 Open Source restrictions on each settingHow to disable magento 2 extension in store view (multistore)Have a option to enable/disable the module. I need to load admin page css when my module is enabled. No need to load css while module is disableHow to setup different Advanced Inventory Options for each store?



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








0















I want to give ability to admin to active or deactive a module for each store.



at previous magento version this option was exist under store -> configuration -> advanced -> advanced menue and we could enable or disable a module per store , but from magento 2.2 this option has been removed and no longer avalable.



according this link for this purpose we have to do some setting manually in our module .



I want to make setting in my module that admin can see the list of stores and by selecting them to enable or disable a module . for example admin wants to enable module be active for store A and B , and deactive for store C .



the list of stores should be dynamic and reads from database and shouldn't be hard code.



I don't have any idea how can I do it .Someone can help me figure out how I can do it ? If you could please point this out, I would be really grateful .










share|improve this question






























    0















    I want to give ability to admin to active or deactive a module for each store.



    at previous magento version this option was exist under store -> configuration -> advanced -> advanced menue and we could enable or disable a module per store , but from magento 2.2 this option has been removed and no longer avalable.



    according this link for this purpose we have to do some setting manually in our module .



    I want to make setting in my module that admin can see the list of stores and by selecting them to enable or disable a module . for example admin wants to enable module be active for store A and B , and deactive for store C .



    the list of stores should be dynamic and reads from database and shouldn't be hard code.



    I don't have any idea how can I do it .Someone can help me figure out how I can do it ? If you could please point this out, I would be really grateful .










    share|improve this question


























      0












      0








      0


      2






      I want to give ability to admin to active or deactive a module for each store.



      at previous magento version this option was exist under store -> configuration -> advanced -> advanced menue and we could enable or disable a module per store , but from magento 2.2 this option has been removed and no longer avalable.



      according this link for this purpose we have to do some setting manually in our module .



      I want to make setting in my module that admin can see the list of stores and by selecting them to enable or disable a module . for example admin wants to enable module be active for store A and B , and deactive for store C .



      the list of stores should be dynamic and reads from database and shouldn't be hard code.



      I don't have any idea how can I do it .Someone can help me figure out how I can do it ? If you could please point this out, I would be really grateful .










      share|improve this question
















      I want to give ability to admin to active or deactive a module for each store.



      at previous magento version this option was exist under store -> configuration -> advanced -> advanced menue and we could enable or disable a module per store , but from magento 2.2 this option has been removed and no longer avalable.



      according this link for this purpose we have to do some setting manually in our module .



      I want to make setting in my module that admin can see the list of stores and by selecting them to enable or disable a module . for example admin wants to enable module be active for store A and B , and deactive for store C .



      the list of stores should be dynamic and reads from database and shouldn't be hard code.



      I don't have any idea how can I do it .Someone can help me figure out how I can do it ? If you could please point this out, I would be really grateful .







      magento2 multistore magento2.2.2 magento2.3.0






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 5 hours ago







      Behzad kahvand

















      asked 6 hours ago









      Behzad kahvandBehzad kahvand

      184




      184




















          1 Answer
          1






          active

          oldest

          votes


















          0














          You can create admin filed using system.xml, then use that field to whatever the location..



          For example..



          By using etc/system.xml



           <group id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
          <label>General Configuration</label>
          <field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
          <label>Module Enable</label>
          <source_model>MagentoConfigModelConfigSourceYesno</source_model>
          </field>
          </group>


          Then get this value in helper class



          /*
          * @return bool
          */
          public function isEnabled($scope = ScopeInterface::SCOPE_STORE)

          return (bool) $this->scopeConfig->isSetFlag(
          'additional_registration_fields/general/enable',
          $scope
          );



          then in block you can use as



          public function isEnabled()

          return $this->helperData->isEnabled();



          & final check on view files of frontend:



          <?php if ($block->isEnabled()) : ?>
          // code here if module is enabled for current storeview
          <?php endif; ?>





          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%2f272335%2fhow-to-active-deactive-a-module-for-each-store-by-admin-in-magento-2-2%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            You can create admin filed using system.xml, then use that field to whatever the location..



            For example..



            By using etc/system.xml



             <group id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
            <label>General Configuration</label>
            <field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
            <label>Module Enable</label>
            <source_model>MagentoConfigModelConfigSourceYesno</source_model>
            </field>
            </group>


            Then get this value in helper class



            /*
            * @return bool
            */
            public function isEnabled($scope = ScopeInterface::SCOPE_STORE)

            return (bool) $this->scopeConfig->isSetFlag(
            'additional_registration_fields/general/enable',
            $scope
            );



            then in block you can use as



            public function isEnabled()

            return $this->helperData->isEnabled();



            & final check on view files of frontend:



            <?php if ($block->isEnabled()) : ?>
            // code here if module is enabled for current storeview
            <?php endif; ?>





            share|improve this answer



























              0














              You can create admin filed using system.xml, then use that field to whatever the location..



              For example..



              By using etc/system.xml



               <group id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
              <label>General Configuration</label>
              <field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
              <label>Module Enable</label>
              <source_model>MagentoConfigModelConfigSourceYesno</source_model>
              </field>
              </group>


              Then get this value in helper class



              /*
              * @return bool
              */
              public function isEnabled($scope = ScopeInterface::SCOPE_STORE)

              return (bool) $this->scopeConfig->isSetFlag(
              'additional_registration_fields/general/enable',
              $scope
              );



              then in block you can use as



              public function isEnabled()

              return $this->helperData->isEnabled();



              & final check on view files of frontend:



              <?php if ($block->isEnabled()) : ?>
              // code here if module is enabled for current storeview
              <?php endif; ?>





              share|improve this answer

























                0












                0








                0







                You can create admin filed using system.xml, then use that field to whatever the location..



                For example..



                By using etc/system.xml



                 <group id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>General Configuration</label>
                <field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Module Enable</label>
                <source_model>MagentoConfigModelConfigSourceYesno</source_model>
                </field>
                </group>


                Then get this value in helper class



                /*
                * @return bool
                */
                public function isEnabled($scope = ScopeInterface::SCOPE_STORE)

                return (bool) $this->scopeConfig->isSetFlag(
                'additional_registration_fields/general/enable',
                $scope
                );



                then in block you can use as



                public function isEnabled()

                return $this->helperData->isEnabled();



                & final check on view files of frontend:



                <?php if ($block->isEnabled()) : ?>
                // code here if module is enabled for current storeview
                <?php endif; ?>





                share|improve this answer













                You can create admin filed using system.xml, then use that field to whatever the location..



                For example..



                By using etc/system.xml



                 <group id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>General Configuration</label>
                <field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Module Enable</label>
                <source_model>MagentoConfigModelConfigSourceYesno</source_model>
                </field>
                </group>


                Then get this value in helper class



                /*
                * @return bool
                */
                public function isEnabled($scope = ScopeInterface::SCOPE_STORE)

                return (bool) $this->scopeConfig->isSetFlag(
                'additional_registration_fields/general/enable',
                $scope
                );



                then in block you can use as



                public function isEnabled()

                return $this->helperData->isEnabled();



                & final check on view files of frontend:



                <?php if ($block->isEnabled()) : ?>
                // code here if module is enabled for current storeview
                <?php endif; ?>






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 36 mins ago









                Arslan TabassumArslan Tabassum

                1216




                1216



























                    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%2f272335%2fhow-to-active-deactive-a-module-for-each-store-by-admin-in-magento-2-2%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

                    Nidaros erkebispedøme

                    Birsay

                    Was Woodrow Wilson really a Liberal?Was World War I a war of liberals against authoritarians?Founding Fathers...