how to active/deactive a module for each store by admin in magento 2.2Enable '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?
When India mathematicians did know Euclid's Elements?
How to determine the actual or "true" resolution of a digital photograph?
How can I record the screen and the rear camera on an iPhone simultaneously?
How to back up a running remote server?
Is it possible to measure lightning discharges as Nikola Tesla?
Multiple options for Pseudonyms
What does YCWCYODFTRFDTY mean?
Reverse the word in a string with the same order in javascript
Please, smoke with good manners
Is thermodynamics only applicable to systems in equilibrium?
What are the spoon bit of a spoon and fork bit of a fork called?
What's the polite way to say "I need to urinate"?
Can someone publish a story that happened to you?
Pulling the rope with one hand is as heavy as with two hands?
Can fracking help reduce CO2?
Is creating your own "experiment" considered cheating during a physics exam?
Why do computer-science majors learn calculus?
Stark VS Thanos
Has any spacecraft ever had the ability to directly communicate with civilian air traffic control?
Why does Bran Stark feel that Jon Snow "needs to know" about his lineage?
Sci-fi novel series with instant travel between planets through gates. A river runs through the gates
What is a Recurrent Neural Network?
Why does processed meat contain preservatives, while canned fish needs not?
Why are the 2nd/3rd singular forms of present of « potere » irregular?
how to active/deactive a module for each store by admin in magento 2.2
Enable '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;
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
add a comment |
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
add a comment |
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
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
magento2 multistore magento2.2.2 magento2.3.0
edited Apr 24 at 20:13
Behzad kahvand
asked Apr 24 at 18:33
Behzad kahvandBehzad kahvand
205
205
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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; ?>
thank you for reply , that's good idea , but I want enable or disable a module for both frontend and adminhtml for specefic stores, and I don't have access to change core magento codes , I want set configuration in my module and these changes apply throughout the store . is there any global variable to hold state of modules in magento that magento checks them for loading modules ?
– Behzad kahvand
Apr 25 at 14:39
Yes, You can enable/disable whole module by using this method too..
– Arslan Tabassum
Apr 25 at 17:01
Just add if condition in every controller's execute method like this ... if ($this->helperData->isEnabled() == 'yes' ) // your whole code here
– Arslan Tabassum
Apr 25 at 17:34
your were right , just one question , how can I use this if condition for prevent load js files ? . I have requirejs-config file that I load some js files instead of core magento js files , how to load these files conditionally ?.
– Behzad kahvand
2 days ago
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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; ?>
thank you for reply , that's good idea , but I want enable or disable a module for both frontend and adminhtml for specefic stores, and I don't have access to change core magento codes , I want set configuration in my module and these changes apply throughout the store . is there any global variable to hold state of modules in magento that magento checks them for loading modules ?
– Behzad kahvand
Apr 25 at 14:39
Yes, You can enable/disable whole module by using this method too..
– Arslan Tabassum
Apr 25 at 17:01
Just add if condition in every controller's execute method like this ... if ($this->helperData->isEnabled() == 'yes' ) // your whole code here
– Arslan Tabassum
Apr 25 at 17:34
your were right , just one question , how can I use this if condition for prevent load js files ? . I have requirejs-config file that I load some js files instead of core magento js files , how to load these files conditionally ?.
– Behzad kahvand
2 days ago
add a comment |
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; ?>
thank you for reply , that's good idea , but I want enable or disable a module for both frontend and adminhtml for specefic stores, and I don't have access to change core magento codes , I want set configuration in my module and these changes apply throughout the store . is there any global variable to hold state of modules in magento that magento checks them for loading modules ?
– Behzad kahvand
Apr 25 at 14:39
Yes, You can enable/disable whole module by using this method too..
– Arslan Tabassum
Apr 25 at 17:01
Just add if condition in every controller's execute method like this ... if ($this->helperData->isEnabled() == 'yes' ) // your whole code here
– Arslan Tabassum
Apr 25 at 17:34
your were right , just one question , how can I use this if condition for prevent load js files ? . I have requirejs-config file that I load some js files instead of core magento js files , how to load these files conditionally ?.
– Behzad kahvand
2 days ago
add a comment |
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; ?>
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; ?>
answered Apr 25 at 0:48
Arslan TabassumArslan Tabassum
1466
1466
thank you for reply , that's good idea , but I want enable or disable a module for both frontend and adminhtml for specefic stores, and I don't have access to change core magento codes , I want set configuration in my module and these changes apply throughout the store . is there any global variable to hold state of modules in magento that magento checks them for loading modules ?
– Behzad kahvand
Apr 25 at 14:39
Yes, You can enable/disable whole module by using this method too..
– Arslan Tabassum
Apr 25 at 17:01
Just add if condition in every controller's execute method like this ... if ($this->helperData->isEnabled() == 'yes' ) // your whole code here
– Arslan Tabassum
Apr 25 at 17:34
your were right , just one question , how can I use this if condition for prevent load js files ? . I have requirejs-config file that I load some js files instead of core magento js files , how to load these files conditionally ?.
– Behzad kahvand
2 days ago
add a comment |
thank you for reply , that's good idea , but I want enable or disable a module for both frontend and adminhtml for specefic stores, and I don't have access to change core magento codes , I want set configuration in my module and these changes apply throughout the store . is there any global variable to hold state of modules in magento that magento checks them for loading modules ?
– Behzad kahvand
Apr 25 at 14:39
Yes, You can enable/disable whole module by using this method too..
– Arslan Tabassum
Apr 25 at 17:01
Just add if condition in every controller's execute method like this ... if ($this->helperData->isEnabled() == 'yes' ) // your whole code here
– Arslan Tabassum
Apr 25 at 17:34
your were right , just one question , how can I use this if condition for prevent load js files ? . I have requirejs-config file that I load some js files instead of core magento js files , how to load these files conditionally ?.
– Behzad kahvand
2 days ago
thank you for reply , that's good idea , but I want enable or disable a module for both frontend and adminhtml for specefic stores, and I don't have access to change core magento codes , I want set configuration in my module and these changes apply throughout the store . is there any global variable to hold state of modules in magento that magento checks them for loading modules ?
– Behzad kahvand
Apr 25 at 14:39
thank you for reply , that's good idea , but I want enable or disable a module for both frontend and adminhtml for specefic stores, and I don't have access to change core magento codes , I want set configuration in my module and these changes apply throughout the store . is there any global variable to hold state of modules in magento that magento checks them for loading modules ?
– Behzad kahvand
Apr 25 at 14:39
Yes, You can enable/disable whole module by using this method too..
– Arslan Tabassum
Apr 25 at 17:01
Yes, You can enable/disable whole module by using this method too..
– Arslan Tabassum
Apr 25 at 17:01
Just add if condition in every controller's execute method like this ... if ($this->helperData->isEnabled() == 'yes' ) // your whole code here
– Arslan Tabassum
Apr 25 at 17:34
Just add if condition in every controller's execute method like this ... if ($this->helperData->isEnabled() == 'yes' ) // your whole code here
– Arslan Tabassum
Apr 25 at 17:34
your were right , just one question , how can I use this if condition for prevent load js files ? . I have requirejs-config file that I load some js files instead of core magento js files , how to load these files conditionally ?.
– Behzad kahvand
2 days ago
your were right , just one question , how can I use this if condition for prevent load js files ? . I have requirejs-config file that I load some js files instead of core magento js files , how to load these files conditionally ?.
– Behzad kahvand
2 days ago
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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