0

I creat system configurations in custom module. I am unable to get required changes in store->configurations.

The code I wrote for system.xml is as follows:

<?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="zipcodevalidator" translate="label" sortOrder="1">
        <label>Zipcode Validator</label>
    </tab>
    <section id="validatorsettings" translate="label" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
        <class>separator-top</class>
        <label>Validator Settings</label>
        <tab>zipcodevalidator</tab>
        <resource>Tm_Zipcode::config</resource>
        <group id="general_settings">
            <label>General Settings</label>
            <field id="enable_disable" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Enable</label>
                <!-- <sorurce_model>Tm\Zipcode\Model\Yesno</source_model> -->
            </field>
            <field id="sucess_message" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Sucess Message</label>
                <comment>Use {zipcode} as zipcode placeholder and {days} as number of days placeholder</comment>
            </field>
            <field id="error_message" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Error Message</label>
                <comment>Use {zipcode} as zipcode placeholder</comment>
            </field>
    </section>
</system>
</config>

The code for acl.xml is as follows

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
    <resources>
        <resource id="Magento_Backend::admin">
            <resource id="Magento_Backend::stores">
                <resource id="Magento_Backend::stores_settings">
                    <resource id="Magento_Config::config">
                        <resource id="Tm_Zipcode::config_zipcode" title="Zipcode Section" sortOrder="50" />
                    </resource>
                </resource>
            </resource>
        </resource>
    </resources>
</acl>
</config>  

I'm really stuck with this. Please help.

2
  • you mean to say, It not display in store configuration? Jan 27, 2017 at 4:54
  • yes.....It won't display the changes.......only the default settings
    – jackson5
    Jan 27, 2017 at 4:57

2 Answers 2

1

You did this change in your code.

  1. Change your resource that specify in acl.xml.
  2. You need to add </group> in your above code.

replace your code with this one.

<?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="zipcodevalidator" translate="label" sortOrder="1">
        <label>Zipcode Validator</label>
    </tab>
    <section id="validatorsettings" translate="label" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
        <class>separator-top</class>
        <label>Validator Settings</label>
        <tab>zipcodevalidator</tab>
        <resource>Tm_Zipcode::config_zipcode</resource>
        <group id="general_settings">
            <label>General Settings</label>
            <field id="enable_disable" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Enable</label>
                <!-- <sorurce_model>Tm\Zipcode\Model\Yesno</source_model> -->
            </field>
            <field id="sucess_message" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Sucess Message</label>
                <comment>Use {zipcode} as zipcode placeholder and {days} as number of days placeholder</comment>
            </field>
            <field id="error_message" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Error Message</label>
                <comment>Use {zipcode} as zipcode placeholder</comment>
            </field>
      </group>
    </section>
</system>
</config>
6
  • no use.......I'm not getting any results
    – jackson5
    Jan 27, 2017 at 5:20
  • just remove var/ and try. we are using this code. Jan 27, 2017 at 5:24
  • Do I need to have any other files except these files and module.xml
    – jackson5
    Jan 27, 2017 at 7:07
  • No, Can you share path of system.xml and acl.xml. Jan 27, 2017 at 7:09
  • app/code/Tm/Zipcode/etc/adminhtml/system.xml & app/code/Tm/Zipcode/etc/acl.xml
    – jackson5
    Jan 27, 2017 at 9:15
2

you made a mistake in resource tab.

In you ACl configuration the resource id is Tm_Zipcode::config_zipcode .

So you have to use the same in the system.xml like

<resource>Tm_Zipcode::config_zipcode</resource>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.