Question

Magento version : 2.1.11 I am using a custom module at custom-module/etc/config.xml there is below file.

<?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>
        <checkDelivery>
            <config>
                <enable>0</enable>
                <postcodes><![CDATA[100000,100001,100002,100003,100004,100005,100006]]></postcodes>
                <success_message><![CDATA[Delivery available]]></success_message>
                <error_message><![CDATA[Item not available at this location, please try another pincode]]></error_message>
            </config>
        </checkDelivery>
    </default>
</config>

When I run :$ php bin/magento setup:upgrade

Element 'enable': This element is not expected. Expected is one of ( default, stores, websites ).                                          
  Line: 6

I got above Exception, any idea is there any reserved keywords which this extension is using?

Is there any link from where I can learn about these files and allowed methods.

Update: File : /etc/adminhtml/system.xml

 <group id="config" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
..............................

Thank You.

Was it helpful?

Solution

In think you have placed an extra <config> tag in your xml or else if you have placed your group id config defined in your system.xml change it to something else.

Try this

<?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>
        <checkDelivery>
            <mygroup>
                <enable>0</enable>
                <postcodes><![CDATA[100000,100001,100002,100003,100004,100005,100006]]></postcodes>
                <success_message><![CDATA[Delivery available]]></success_message>
                <error_message><![CDATA[Item not available at this location, please try another pincode]]></error_message>
            </mygroup>
        </checkDelivery>
    </default>
</config>

OTHER TIPS

We cannot specify config tag twice in config.xml

Example in your case replace 2nd tag with other tag name . Specify that tag name in system.xml file of your module Tag name specifies the id of the group tag in system.xml file

Please run upgrade & deploy command and refresh .

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top