0

I'm tryingto extend Magento2 Adminhtml with some custom nodes, which has worked good so far. What I'm trying to do now is to figure out how this error is happening:

Exception #0 (Exception): Notice: Undefined index: id in /var/www/magento/vendor/magento/module-config/Model/Config/Structure/Element/Iterator.php on line 63

So basically this issue is coming from malformed XML files that handles my adminhtml.

ACL:

<?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="Vendor_Module::config" title="Config for Advanced Catalog" sortOrder="100"/>
                        </resource>
                    </resource>
                </resource>
            </resource>
        </resources>
    </acl>
</config>

config:

<?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>
        <advancedcatalog>
            <general>
                <enabled>1</enabled>
                <debug>0</debug>
            </general>
        </advancedcatalog>
    </default>
</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>
        <section id="advancedcatalog" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" translate="label">
            <label>Advanced Catalog</label>
            <tab>advancedcatalog</tab>
            <resource>Vendor_Module::config</resource>
            <group id="general" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1"
                   showInStore="1">
                <label>General</label>
                <field id="enabled" translate="label" type="select" sortOrder="1" showInDefault="1" showInStore="1"
                       showInWebsite="1">
                    <label>Enabled</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="debug" translate="label" type="select" sortOrder="2" showInDefault="1" showInStore="1"
                       showInWebsite="1">
                    <label>Debug Mode</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
            </group>
        </section>
    </system>
</config>

However, if I flush and clean cache's I'll get the error message. I do know that this error is coming when there are different IDs, however I cannot figure out where I made my mistake.

1 Answer 1

1

The solution was to define the Tab I want to display my entities. To do so I just had to update system.xml with the following:

<?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="vendor_main_node" translate="label" sortOrder="200">
            <label>Vendor</label>
        </tab>
        <section id="advancedcatalog" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" translate="label">
            <label>Advanced Catalog</label>
            <tab>vendor_main_node</tab>
            <resource>Vendor_Module::config</resource>
            ....

Your Answer

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

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