4

a:4:{i:0;s:134:"Notice: Undefined index: id in C:\xampp\htdocs\sea\vendor\magento\module-config\Model\Config\Structure\Element\Iterator.php on line 59";i:1;s:6225:"#0 C:\xampp\htdocs\sea\vendor\magento\module-config\Model\Config\Structure\Element\Iterator.php(59): Magento\Framework\App\ErrorHandler->handler(8, 'Undefined index...', 'C:\xampp\htdocs...', 59, Array)

This is my system.xml file

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Backend/etc/system_file.xsd">
    <system>
        <section id="iwd_opc" translate="label" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
            <label>One Step Checkout</label>
            <tab>iwd</tab>
            <resource>IWD_Opc::system_config</resource>

            <group id="info" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Info</label>
                <field id="version" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
                    <label>Version</label>
                    <frontend_model>IWD\Opc\Block\Adminhtml\System\Config\Version</frontend_model>
                </field>
                <field id="documentation" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="0" showInStore="0">
                    <label>Documentation</label>
                    <frontend_model>IWD\Opc\Block\Adminhtml\System\Config\Documentation</frontend_model>
                </field>
            </group>

            <group id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>General Settings</label>
                <field id="enable_in_frontend" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Enable</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="opc_title" translate="label" type="text" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Meta Title</label>
                </field>

                <field id="opc_discount_enable" translate="label" type="select" sortOrder="7" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Display Discount Field</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>

                <field id="onepage_checkout_comments_enabled" translate="label" type="select" sortOrder="99" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Enable Order Comments?</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
            </group>

        </section>
    </system>
</config>

this is 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="IWD_StoreCredit::system_config" title="IWD Store Credit" />
                        </resource>
                    </resource>
                </resource>
            </resource>
        </resources>
    </acl>
</config>
  • 1
    are you sure the error appears because of one of these 2 files? If you remove (or rename) the files so they won't be taken into consideration, does the error disappear? – Marius Sep 1 '16 at 12:23
11

You should add this code after <system> and before <section id="iwd_opc"... in file system.xml:

<tab id="iwd" translate="label" sortOrder="500">
     <label>iwd</label>
</tab>

you can change sortOrder value as you want.

0

In my case add this field in system.xml file because this values used in code but not defined in system.xml file.

<field id="opc_discount_enable" translate="label" type="select" sortOrder="7" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Display Discount Field</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>

<field id="onepage_checkout_comments_enabled" translate="label" type="select" sortOrder="99" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable Order Comments?</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>

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.