2

I am trying to bring some system configurations for my custom module in the backend. I wrote the following code for the configurations but I am not getting any results.

Tm/Productpoll/etc/acl.xml

<?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_Productpoll::config" title="Productpoll Section" sortOrder="50" />
                    </resource>
                </resource>
            </resource>
        </resource>
    </resources>
</acl>
</config>  

Tm/Productpoll/etc/adminhtml/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="productpoll" translate="label" sortOrder="300">
        <label>Product Poll</label>
    </tab>
    <section id="productpollsettings" translate="label" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
        <class>separator-top</class>
        <label>Product Poll Settings</label>
        <tab>productpoll</tab>
        <resource>Tm_Productpoll::config</resource>
        <group id="general_settings" translate="label" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
            <label>General Settings</label>
            <field id="enable_disable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Enable</label>
                <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
            </field>
        </group>
    </section>
</system>
</config>

Can anyone help me out.

1

acl.xml

<?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_Productpoll::config_productpoll" title="Productpoll Section" />
                            </resource>
                        </resource>
                    </resource>                 
            </resource>
        </resources>        
    </acl>
</config>

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="productpoll" translate="label" sortOrder="300">
        <label>Product Poll</label>
    </tab>
    <section id="productpollsettings" translate="label" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
        <class>separator-top</class>
        <label>Product Poll Settings</label>
        <tab>productpoll</tab>
        <resource>Tm_Productpoll::config_productpoll</resource>
        <group id="general_settings" translate="label" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
            <label>General Settings</label>
            <field id="enable_disable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Enable</label>
                <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
            </field>
        </group>
    </section>
</system>
</config>
| improve this answer | |
  • no use, I'm not getting any results – jackson5 Mar 1 '17 at 9:17
-2

On your system.xml instead of

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">

Use

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Config/etc/system_file.xsd">

Below is example of both

acl.xml

<?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="Custom_Module::banner" title="eTrade" sortOrder="100" >
                    <resource id="Custom_Module::configuration" title="Configuration" sortOrder="1000" />
                </resource>
            </resource>
        </resources>
    </acl>
</config>

system.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Config/etc/system_file.xsd">
    <system>
        <tab id="sampletab" translate="label" sortOrder="1">
            <label>Test</label>
        </tab>
        <section id="banner" translate="label" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1">
            <class>separator-top</class>
            <label>Banner</label>
            <tab>tab</tab>
            <resource>Custom_Module::configuration</resource>
            <group id="settings" showInDefault="1" showInStore="1" showInWebsite="1" sortOrder="1" translate="label">
                <label>General Settings</label>
                <field id="enable_module" type="select" sortOrder="10" showInDefault="1" showInStore="1" showInWebsite="1">
                    <label>Enable Module</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
            </group>
        </section>
    </system>
</config>

Afer that run

php bin/magento setup:di:compile
php bin/magento cache:flush
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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