0

I am trying to create a custom module in admin but for some reason modules settings are not appearing.
Below is my code.
app/code/Anshu/TrackingImport/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="Anshu_import" translate="label" sortOrder="10">
            <label>Anshu Import Options</label>
        </tab>
        <section id="Anshu_import_section" translate="label" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="1">
            <class>separator-top</class>
            <label>Anshu Import Options</label>
            <tab>Anshu_import</tab>
            <resource>Anshu_TrackingImport::trackingimport</resource>
            <group id="ftp_credentials" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>FTP Credentials</label>
                <comment>You must enter your live FTP credentials for this extension to work properly</comment>
                <field id="ftp_login">
                    <label>FTP Login</label>
                </field>
                <field id="ftp_password">
                    <label>FTP Password</label>
                </field>
            </group>
            <group id="cron_settings" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Cron Settings</label>
                <field id="expression">
                    <label>Cron Expression</label>
                    <source_model>Anshu\TrackingImport\Model\Cron</source_model>
                </field>
            </group>
        </section>
    </system>
</config>

app/code/Anshu/TrackingImport/etc/acl.xml

<?xml version="1.0" encoding="UTF-8"?>
<config 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="Anshu_TrackingImport::trackingimport" title="Anshu Order Import" sortOrder="51" />
                        </resource>
                    </resource>
                </resource>
            </resource>
        </resources>
    </acl>
</config>

app/code/Anshu/TrackingImport/etc/module.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Anshu_TrackingImport" setup_version="0.1.0">
        <sequence/>
    </module>
</config>

app/code/Anshu/TrackingImport/registration.php

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Anshu_TrackingImport',
    __DIR__
);

It would be great if someone can help me out in finding out the reason and how I can fix it.

2
  • I hope you have run setup command when created the module.
    – arushi
    Commented May 19, 2017 at 10:20
  • Yes, I have ran the command Commented May 19, 2017 at 10:29

2 Answers 2

4

Try with below format,

<?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="Anshu_import" translate="label" sortOrder="10">
            <label>Anshu Import Options</label>
        </tab>
        <section id="Anshu_import_section" translate="label" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="1">
            <class>separator-top</class>
            <label>Anshu Import Options</label>
            <tab>Anshu_import</tab>
            <resource>Anshu_TrackingImport::trackingimport</resource>
            <group id="ftp_credentials" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>FTP Credentials</label>
                <comment>You must enter your live FTP credentials for this extension to work properly</comment>
                <field id="ftp_login" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0">
                    <label>FTP Login</label>
                </field>
                <field id="ftp_password" translate="label comment" type="password" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0">
                    <label>FTP Password</label>
                </field>
            </group>
            <group id="cron_settings" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Cron Settings</label>
                <field id="expression">
                    <label>Cron Expression</label>
                    <source_model>Anshu\TrackingImport\Model\Cron</source_model>
                </field>
            </group>
        </section>
    </system>
</config>
4
  • 1
    i think you forgot <field id="ftp_login" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0"> in your fop login and ftp password. Commented May 19, 2017 at 10:31
  • But what is the issue here? Are these attributes compulsory? Commented May 19, 2017 at 10:39
  • Yes,Its used for which type of attribute field like input,select,Boolean(Yes/No) Commented May 19, 2017 at 10:40
  • 1
    If these attributes are compulsory then Magento should throw some exception or error, otherwise it is difficult to find the issue. Commented May 19, 2017 at 10:45
0

For anyone this may help, it's also possible that your settings aren't showing in admin due to the class not existing that you have configured in <source_model> or other model node (e.g. <frontend_model>). Double check this that you have no typos or anything.

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.