Magento 2 - My custom module with admin config is not returning the correct value specified The Next CEO of Stack OverflowMagento 2: How to get system.xml config values?New Magento 2.0.0 module gives error: Setup version not specifiedmagento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2 - How to create a custom module with admin config?Custom Module custom block not loading the template in magento 2 adminMagento 2: Setup version for module is not specifiedMagento 2.2.5: Overriding Admin Controller sales/orderMagento 2 Custom admin module not workingMagento 2.2.5: Add, Update and Delete existing products Custom Options
Why has the US not been more assertive in confronting Russia in recent years?
What do "high sea" and "carry" mean in this sentence?
What happens if you roll doubles 3 times then land on "Go to jail?"
Is HostGator storing my password in plaintext?
How to make a variable always equal to the result of some calculations?
Written every which way
WOW air has ceased operation, can I get my tickets refunded?
Is there an analogue of projective spaces for proper schemes?
Can I equip Skullclamp on a creature I am sacrificing?
How to Reset Passwords on Multiple Websites Easily?
How did people program for Consoles with multiple CPUs?
How to start emacs in "nothing" mode (`fundamental-mode`)
Does it take more energy to get to Venus or to Mars?
Why do we use the plural of movies in this phrase "We went to the movies last night."?
Are there any limitations on attacking while grappling?
Why do remote companies require working in the US?
Bold, vivid family
Novel about a guy who is possessed by the divine essence and the world ends?
How to add tiny 0.5A 120V load to very remote split phase 240v 3 wire well house
MessageLevel in QGIS3
Can you replace a racial trait cantrip when leveling up?
What happened in Rome, when the western empire "fell"?
What does convergence in distribution "in the Gromov–Hausdorff" sense mean?
Why do professional authors make "consistency" mistakes? And how to avoid them?
Magento 2 - My custom module with admin config is not returning the correct value specified
The Next CEO of Stack OverflowMagento 2: How to get system.xml config values?New Magento 2.0.0 module gives error: Setup version not specifiedmagento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2 - How to create a custom module with admin config?Custom Module custom block not loading the template in magento 2 adminMagento 2: Setup version for module is not specifiedMagento 2.2.5: Overriding Admin Controller sales/orderMagento 2 Custom admin module not workingMagento 2.2.5: Add, Update and Delete existing products Custom Options
I create the System.xml:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<tab id="modulenotifications" translate="label" sortOrder="10">
<label>module Notifications</label>
</tab>
<section id="notificationspermissions" translate="label" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="1">
<class>separator-top</class>
<label>Notifications Permissions</label>
<tab>modulenotifications</tab>
<resource>Vendor_moduleNotifications::modulenotifications_config</resource>
<group id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Habilitar/Desabilitar Notificações </label>
<field id="enablesendsolicitation" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Send Solicitation</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
<field id="enableconfirmquotation" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Confirm Quotation</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
<field id="enablesendnegotiation" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Send Negotiation</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
<field id="enableapprovequotation" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Approve Quotation</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
<field id="enableapprovenegotiation" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Approve Negotiation</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
</group>
</section>
</system>
</config>
and the config.xml:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<notifications>
<general>
<enablesendsolicitation>1</enablesendsolicitation>
<enableconfirmquotation>1</enableconfirmquotation>
<enablesendnegotiation>1</enablesendnegotiation>
<enableapprovequotation>1</enableapprovequotation>
<enableapprovenegotiation>1</enableapprovenegotiation>
</general>
</notifications>
</default>
</config>
and in my helper:
const XML_PATH_NOTIFICATIONS = 'notifications/';
public function getConfigValue($field, $storeId = null)
return $this->scopeConfig->getValue(
$field, ScopeInterface::SCOPE_STORE, $storeId
);
public function getGeneralConfig($code, $storeId = null)
return $this->getConfigValue(self::XML_PATH_NOTIFICATIONS.'general/'. $code, $storeId);
In the admin dashboard, i have the options, and when i change the value and c:c,c:f ou reload, the data its the what i saved. But, when i try to get the config value in my controller, with this form:
$this->helper->getGeneralConfig('enablesendsolicitation')
this return the value saved in the config.xml and the value of config.xml is not the value defined in magento dashboard, what im doing wrong ? how can i get the value defined in the admin dashboard?
im follow this tutorials:
mageplaza
and this exchange link:
magento stack exchange
magento2
add a comment |
I create the System.xml:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<tab id="modulenotifications" translate="label" sortOrder="10">
<label>module Notifications</label>
</tab>
<section id="notificationspermissions" translate="label" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="1">
<class>separator-top</class>
<label>Notifications Permissions</label>
<tab>modulenotifications</tab>
<resource>Vendor_moduleNotifications::modulenotifications_config</resource>
<group id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Habilitar/Desabilitar Notificações </label>
<field id="enablesendsolicitation" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Send Solicitation</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
<field id="enableconfirmquotation" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Confirm Quotation</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
<field id="enablesendnegotiation" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Send Negotiation</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
<field id="enableapprovequotation" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Approve Quotation</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
<field id="enableapprovenegotiation" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Approve Negotiation</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
</group>
</section>
</system>
</config>
and the config.xml:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<notifications>
<general>
<enablesendsolicitation>1</enablesendsolicitation>
<enableconfirmquotation>1</enableconfirmquotation>
<enablesendnegotiation>1</enablesendnegotiation>
<enableapprovequotation>1</enableapprovequotation>
<enableapprovenegotiation>1</enableapprovenegotiation>
</general>
</notifications>
</default>
</config>
and in my helper:
const XML_PATH_NOTIFICATIONS = 'notifications/';
public function getConfigValue($field, $storeId = null)
return $this->scopeConfig->getValue(
$field, ScopeInterface::SCOPE_STORE, $storeId
);
public function getGeneralConfig($code, $storeId = null)
return $this->getConfigValue(self::XML_PATH_NOTIFICATIONS.'general/'. $code, $storeId);
In the admin dashboard, i have the options, and when i change the value and c:c,c:f ou reload, the data its the what i saved. But, when i try to get the config value in my controller, with this form:
$this->helper->getGeneralConfig('enablesendsolicitation')
this return the value saved in the config.xml and the value of config.xml is not the value defined in magento dashboard, what im doing wrong ? how can i get the value defined in the admin dashboard?
im follow this tutorials:
mageplaza
and this exchange link:
magento stack exchange
magento2
add a comment |
I create the System.xml:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<tab id="modulenotifications" translate="label" sortOrder="10">
<label>module Notifications</label>
</tab>
<section id="notificationspermissions" translate="label" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="1">
<class>separator-top</class>
<label>Notifications Permissions</label>
<tab>modulenotifications</tab>
<resource>Vendor_moduleNotifications::modulenotifications_config</resource>
<group id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Habilitar/Desabilitar Notificações </label>
<field id="enablesendsolicitation" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Send Solicitation</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
<field id="enableconfirmquotation" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Confirm Quotation</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
<field id="enablesendnegotiation" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Send Negotiation</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
<field id="enableapprovequotation" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Approve Quotation</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
<field id="enableapprovenegotiation" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Approve Negotiation</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
</group>
</section>
</system>
</config>
and the config.xml:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<notifications>
<general>
<enablesendsolicitation>1</enablesendsolicitation>
<enableconfirmquotation>1</enableconfirmquotation>
<enablesendnegotiation>1</enablesendnegotiation>
<enableapprovequotation>1</enableapprovequotation>
<enableapprovenegotiation>1</enableapprovenegotiation>
</general>
</notifications>
</default>
</config>
and in my helper:
const XML_PATH_NOTIFICATIONS = 'notifications/';
public function getConfigValue($field, $storeId = null)
return $this->scopeConfig->getValue(
$field, ScopeInterface::SCOPE_STORE, $storeId
);
public function getGeneralConfig($code, $storeId = null)
return $this->getConfigValue(self::XML_PATH_NOTIFICATIONS.'general/'. $code, $storeId);
In the admin dashboard, i have the options, and when i change the value and c:c,c:f ou reload, the data its the what i saved. But, when i try to get the config value in my controller, with this form:
$this->helper->getGeneralConfig('enablesendsolicitation')
this return the value saved in the config.xml and the value of config.xml is not the value defined in magento dashboard, what im doing wrong ? how can i get the value defined in the admin dashboard?
im follow this tutorials:
mageplaza
and this exchange link:
magento stack exchange
magento2
I create the System.xml:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<tab id="modulenotifications" translate="label" sortOrder="10">
<label>module Notifications</label>
</tab>
<section id="notificationspermissions" translate="label" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="1">
<class>separator-top</class>
<label>Notifications Permissions</label>
<tab>modulenotifications</tab>
<resource>Vendor_moduleNotifications::modulenotifications_config</resource>
<group id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Habilitar/Desabilitar Notificações </label>
<field id="enablesendsolicitation" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Send Solicitation</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
<field id="enableconfirmquotation" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Confirm Quotation</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
<field id="enablesendnegotiation" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Send Negotiation</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
<field id="enableapprovequotation" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Approve Quotation</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
<field id="enableapprovenegotiation" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Approve Negotiation</label>
<source_model>MagentoConfigModelConfigSourceYesno</source_model>
</field>
</group>
</section>
</system>
</config>
and the config.xml:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<notifications>
<general>
<enablesendsolicitation>1</enablesendsolicitation>
<enableconfirmquotation>1</enableconfirmquotation>
<enablesendnegotiation>1</enablesendnegotiation>
<enableapprovequotation>1</enableapprovequotation>
<enableapprovenegotiation>1</enableapprovenegotiation>
</general>
</notifications>
</default>
</config>
and in my helper:
const XML_PATH_NOTIFICATIONS = 'notifications/';
public function getConfigValue($field, $storeId = null)
return $this->scopeConfig->getValue(
$field, ScopeInterface::SCOPE_STORE, $storeId
);
public function getGeneralConfig($code, $storeId = null)
return $this->getConfigValue(self::XML_PATH_NOTIFICATIONS.'general/'. $code, $storeId);
In the admin dashboard, i have the options, and when i change the value and c:c,c:f ou reload, the data its the what i saved. But, when i try to get the config value in my controller, with this form:
$this->helper->getGeneralConfig('enablesendsolicitation')
this return the value saved in the config.xml and the value of config.xml is not the value defined in magento dashboard, what im doing wrong ? how can i get the value defined in the admin dashboard?
im follow this tutorials:
mageplaza
and this exchange link:
magento stack exchange
magento2
magento2
asked 2 days ago
Prostetnic Vogon JeltzProstetnic Vogon Jeltz
184
184
add a comment |
add a comment |
0
active
oldest
votes
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%2f267704%2fmagento-2-my-custom-module-with-admin-config-is-not-returning-the-correct-valu%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f267704%2fmagento-2-my-custom-module-with-admin-config-is-not-returning-the-correct-valu%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