1

enter image description here

i have error when i go to stores->configuration after i create my system.xml file

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="sega" translate="label" sortOrder="20" showInDefault="1" 
 showInWebsite="1" showInStore="1">
        <label>sega</label>
        <tab>SEGA</tab>
        <resource>Magento_Backend::system</resource>
        <group id="general" translate="label" type="text" sortOrder="10" 
showInDefault="1" showInWebsite="1"
               showInStore="1">
            <label>General Configuration</label>
            <field id="enable" translate="label" type="select" sortOrder="10" 
   showInDefault="1" showInWebsite="1"
                   showInStore="1">
                <label>Enable Module</label>
                <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
            </field>
            <field id="coins_back_percent" translate="label" type="text" sortOrder="20" 
  showInDefault="1"
                   showInWebsite="1"
                   showInStore="1">
                <depends>
                    <field id="enable">1</field>
                </depends>
                <label>Percent of purchase</label>
                <validate>validate-number validate-greater-than-zero</validate>
            </field>
            <field id="enable_pdp_message" translate="label" type="select" 
     sortOrder="30" showInDefault="1"
                   showInWebsite="1"
                   showInStore="1">
                <depends>
                    <field id="enable">1</field>
                </depends>
                <label>Show message on PDP</label>
                <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
            </field>
        </group>
    </section>
    <section id="payment">
        <group id="coins" translate="label" sortOrder="100" showInDefault="1" 
  showInWebsite="1" showInStore="1">
            <label>Coins Payment Method</label>
            <field id="active" translate="label" sortOrder="10" type="select" 
  showInDefault="1" showInWebsite="1"
                   showInStore="1">
                <label>Enable</label>
                <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
            </field>
            <field id="title" translate="label" type="text" sortOrder="20" 
  showInDefault="1" showInWebsite="1" showInStore="1">
                <label>custom</label>
            </field>
        </group>
    </section>
</system>

1 Answer 1

2

Your tab "SEGA" is missing. You must declare a new tab or point your sections to an existing tab when declaring section.

To add tab to your system configuration, add the code below:

<tab id="SEGA" translate="label" sortOrder="300">
    <label>SEGA</label>
</tab>

Finally, your system.xml looks like this:

<?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="SEGA" translate="label" sortOrder="300">
            <label>SEGA</label>
        </tab>
        <section id="sega" translate="label" sortOrder="20" showInDefault="1" 
     showInWebsite="1" showInStore="1">
            <label>sega</label>
            <tab>SEGA</tab>
            <resource>Magento_Backend::system</resource>
            <group id="general" translate="label" type="text" sortOrder="10" 
    showInDefault="1" showInWebsite="1"
                   showInStore="1">
                <label>General Configuration</label>
                <field id="enable" translate="label" type="select" sortOrder="10" 
       showInDefault="1" showInWebsite="1"
                       showInStore="1">
                    <label>Enable Module</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="coins_back_percent" translate="label" type="text" sortOrder="20" 
      showInDefault="1"
                       showInWebsite="1"
                       showInStore="1">
                    <depends>
                        <field id="enable">1</field>
                    </depends>
                    <label>Percent of purchase</label>
                    <validate>validate-number validate-greater-than-zero</validate>
                </field>
                <field id="enable_pdp_message" translate="label" type="select" 
         sortOrder="30" showInDefault="1"
                       showInWebsite="1"
                       showInStore="1">
                    <depends>
                        <field id="enable">1</field>
                    </depends>
                    <label>Show message on PDP</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
            </group>
        </section>
        <section id="payment">
            <group id="coins" translate="label" sortOrder="100" showInDefault="1" 
      showInWebsite="1" showInStore="1">
                <label>Coins Payment Method</label>
                <field id="active" translate="label" sortOrder="10" type="select" 
      showInDefault="1" showInWebsite="1"
                       showInStore="1">
                    <label>Enable</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="title" translate="label" type="text" sortOrder="20" 
      showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>custom</label>
                </field>
            </group>
        </section>
    </system>
</config>

3
  • Tu Van Thank you friend, you saved my life!
    – Miron
    Commented Nov 27, 2022 at 7:17
  • @Miron Glad to help. I hope you enjoy Magento development.
    – Tu Van
    Commented Nov 27, 2022 at 7:32
  • 1
    I'm just trying to learn!))
    – Miron
    Commented Nov 27, 2022 at 18:39

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.