0

I've tried to add a configuration item to sales/carriers/fedex in my custom moduel, but seems not work

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <section id="carriers">
            <group id="fedex" type="" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="1" translate="label">
                <label>Fedex test append</label>
                <field id="test" translate="label" sortOrder="1" type="select" showInDefault="1" showInWebsite="1" showInStore="0">
                    <label>Enabled</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
            </group>
        </section>
    </system>
</config>

Are there any ways to do that?

1

Yes, you can. Step 1: add Magento_Fedex module sequence into your module.xml

<module name="Namespace_ModuleName" setup_version="2.0.2" >
    <sequence>
        <module name="Magento_Fedex"/>
    </sequence>
</module>

Step 2: Your system.xml define exactly construct like Magento_Fedex::system.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <section id="carriers">
            <group id="fedex">
                <field id="test" translate="label" sortOrder="1" type="select" showInDefault="1" showInWebsite="1" showInStore="0">
                    <label>Enabled</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
            </group>
        </section>
    </system>
</config>

Step 3: run bin/magento setup:upgrade

0

Don't forget the system.xml file goes into Vendor/Module/etc/adminhtml

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.