We’re rewarding the question askers & reputations are being recalculated! Read more.
40

yes, Magento 2 still allows you to define the default values inside a configuration file. namespace\modulename\etc\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> <...


37

Field id from depends node must contain section, group and field id's of the field you want to depend <depends> <field id="section_id/group_id/field_id">1</field> </depends>


35

Implementing in a class, class Dummy { /** * @var \Magento\Framework\App\Config\ScopeConfigInterface */ protected $scopeConfig; /** * Recipient email config path */ const XML_PATH_EMAIL_RECIPIENT = 'contact/email/recipient_email'; public function __construct(\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig) { ...


29

Try this: <depends> <field separator="|"> <value>1|2|3</value> </field> </depends>


29

Check your Deployment Mode it is in Production. To enable the developer tab menu under the Advanced You need to change it to Developer Mode So run this command : php bin/magento deploy:mode:set developer Clear the cache by running this command : php bin/magento cache:clean Now check Go to admin ->logged in ->click on stores ->configuration->advanced -...


22

In your system.xml replace this <tab>HelloWorldMVVM</tab> with this <tab>Pulsestorm</tab>


19

I think <frontend_model> works for you as like Magento1 <field id="recipient_email" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Send Emails To</label> <validate>validate-email</validate> <...


16

As @Cags said, this is not (easily) possible because the ACL tree is loaded when the session is initialized (AKA when the admin logs in). A possible workaround would be to override the _isSectionAllowed method in system configuration controller: (Mage_Adminhtml_System_ConfigController::_isSectionAllowed) and make it reload the ACL tree. Something like: ...


16

If you add the following in your system.xml <frontend_type>text</frontend_type> <frontend_model>namespace_module/adminhtml_system_config_date</frontend_model> Then create the following file: app/code/[codePool]/Namespace/Module/Block/Adminhtml/System/Config/Date.php class Namespace_Module_Block_Adminhtml_System_Config_Date extends ...


16

I'm not sure about EE, but in CE this is a vestigial tag from a never completed help system. The intent appears to have been to give each form field in the System configuration section a small "hint", or help text. The help text is added when the field element is created #File: app/code/core/Mage/Adminhtml/Block/System/Config/Form.php $hint = (string)$...


16

Create a function for getting configuration values in your custom module's helper. public function getConfig($config_path) { return $this->scopeConfig->getValue( $config_path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); } and call anywhere you want for example in test.phtml $moduleStatus = $this->...


13

You can apply validation on textbox in magento 2 like this, <field id="custom_path" translate="label comment" type="text" sortOrder="4" showInDefault="1" showInWebsite="0" showInStore="0"> <label>Custom Admin Path</label> <validate>required-entry</validate> <comment>You will have to sign in after ...


12

Reason for The Issue The issue you are facing is related to Javascript functionality for getting value of a multiselect attribute. Magento's dependable fields are based on Javascript. They creates a JSON with all fields and dependable fields values like below. array (size=2) 'brandlogo_general_pushonhover' => array (size=2) '...


10

So, user can create as many key ==> value pair matching as they want. For this I would recommend the "Array" frontend and backend models, which work similar to the tier price definition in products. You would create a matrix with 2 columns that can easily be transformed to a key=>value map if needed. With a little extension to the frontend model you can use ...


10

After consulting the appropriate core file a cross group/fieldset <depends> looks like this: <!-- … --> <hello_message> <label>Message</label> <frontend_type>text</frontend_type> <sort_order>1</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</...


9

You can specify a frontend model to your field like this: <field_name translate="label"> <label>Field name</label> <frontend_type>select</frontend_type> <frontend_model>module/field_name_renderer</frontend_model><!-- this is it --> <source_model>adminhtml/system_config_source_yesno</...


9

I found a way around this with very little customization. What we need is: A new controller action that reloads the ACL (without logging out and in), then redirects back to the previous page: class SSE_AclReload_Adminhtml_Permissions_AclReloadController extends Mage_Adminhtml_Controller_Action { public function indexAction() { $session = ...


9

Keyur Shah's answer is correct but I found that it is not possible to copy the value of the disabled element. So instead of writing $element->setDisabled('disabled'); you can write $element->setData('readonly', 1);. This displays the field the same way but you can mark the value and copy it.


8

If you do not use frontend_model your html for two fields will look like this <tr id="row_you_dependency_field_id"> <td class="label"><label for="you_dependency_field_id">Dependency Field</label></td> <td class="value"> <select id="you_dependency_field_id" name="groups[general][fields][...


8

system.xml can not be override but you can hide section by creating module put below code in your modules system.xml file <?xml version="1.0"?> <config> <sections> <sales> <groups> <gift_options translate="label" module="giftmessage"> <...


8

You can use a a model to generate the comment for a config field: Something like this: <comment> <model>ultimate_shipper/adminhtml_allowedmethods_comment</model> </comment> then you need to create the file: Ultimate/Shipper/Model/Adminhtml/Allowedmethods/Comment.php with this content: <?php class ...


8

you can attach a backend model to the field and you can validate the value server side. You can find an example in Magento_Backend/etc/adminhtml/system.xml: <field id="base_url" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Base URL</label> <backend_model>...


8

Add the following to the <orderPlaceMessage> element: <validate>validate-length maximum-length-150</validate> This will add these validation CSS classes used by prototype.js. If you enter a longer value, you will see this generic validation message: So it is a good idea to add a comment as well to let the user know what this range is: &...


8

I got the same error but my system.xml syntax was correct, so it was something else. Turns out it was the result of my cron_group being incorrectly configured, which caused errors when trying to save cron configuration under Configuration > Advanced > System. It was fixed by adding this to my cron group: <use_separate_process>1</...


8

In your config.xml file, you can specify default values for the admin configuration form that you created in system.xml. If a user manually entered a value in one of those fields, they can reset the field to the default value that you specified in config.xml.


7

The first section to show up is the one with the lowest sort order. If you have the following code in your system.xml: <?xml version="1.0"?> <config> <sections> <your_section translate="label" module="your_helper_alias"> <label>Your Section</label> <tab>any</tab> ...


7

[EDIT] I was wrong in my answer below. I will not delete it (yet) because I got 7 upvotes on this :). But I'm editing it so you all have the chance to retract your vote (even downvote it, because I deserve it). Original Answer Ha!..I found it. Short answer: You cannot! Long answer: You should be able to do it if someone would have known the difference ...


7

An element from system.xml can have a dynamic comment. The comment can be rendered through a model. You need to declare the comment field like this: <comment> <model>module/adminhtml_comment</model> </comment> Now you need to create the model with alias module/adminhtml_comment: <?php class ...


7

In theory you can set any config value in the database (table core_config_data). But for most of the cases, the values saved there have the path column like this: section/group/field. So only 3 parts. The cron schedule is an exception. The general config of Magento comes from different sources. All of these sources are merged into one big xml. In case ...


7

Dropdown cannot get it Source model macerier_test/system_config_source_dropdown_values that why it showing the error May be you did not define model prefix. As per as your code macerier_test . is models prefix So let define model prefix at config.xml config.xml <?xml version="1.0"?> <config> <modules> <Macerier_TEST&...


Only top voted, non community-wiki answers of a minimum length are eligible