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
Won the lottery - how do I keep the money?
What benefits would be gained by using human laborers instead of drones in deep sea mining?
Are there any unintended negative consequences to allowing PCs to gain multiple levels at once in a short milestone-XP game?
If a black hole is created from light, can this black hole then move at speed of light?
Why does standard notation not preserve intervals (visually)
Why do professional authors make "consistency" mistakes? And how to avoid them?
Why am I allowed to create multiple unique pointers from a single object?
Between two walls
Is it possible to search for a directory/file combination?
What connection does MS Office have to Netscape Navigator?
MessageLevel in QGIS3
What happens if you roll doubles 3 times then land on "Go to jail?"
Would this house-rule that treats advantage as a +1 to the roll instead (and disadvantage as -1) and allows them to stack be balanced?
Different harmonic changes implied by a simple descending scale
Can I equip Skullclamp on a creature I am sacrificing?
Is there a way to save my career from absolute disaster?
If the heap is initialized for security, then why is the stack uninitialized?
Should I tutor a student who I know has cheated on their homework?
Is it ever safe to open a suspicious html file (e.g. email attachment)?
"and that skill is always a class skill for you" - does "always" have any meaning in Pathfinder?
Why didn't Khan get resurrected in the Genesis Explosion?
How do scammers retract money, while you can’t?
Why do we use the plural of movies in this phrase "We went to the movies last night."?
Can you replace a racial trait cantrip when leveling up?
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