0

In my custom module I have added a tab to the admin configuration section to manage service providers for an external service. I have creted the following group in my system.xml of my module:

<section>
    <mymodule>
        <groups name="providers">
            <provider1>
                <label>Provider 1</label>
                <sort_order>100</sort_order>
                <show_in_default>1</show_in_default>
                <show_in_website>1</show_in_website>
                <show_in_store>1</show_in_store>
                <fields>
                    <name>
                        <label>Name</label>
                        <frontend_type>text</frontend_type>
                        <sort_order>10</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                    </name>
                </fields>
            </provider1>
            <provider2>
                <label>Provider 2</label>
                <sort_order>320</sort_order>
                <show_in_default>1</show_in_default>
                <show_in_website>1</show_in_website>
                <show_in_store>1</show_in_store>
                <fields>
                    <name>
                        <label>Name</label>
                        <frontend_type>text</frontend_type>
                        <sort_order>10</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                    </name>
                </fields>
            </provider2>
        </groups>
    </mymodule>
</section>

This results in my config using the following path:

mymodule/provider1/name or mymodule/provider2/name

What I would like to do is use the following path:

mymodule/providers/provider1/name etc

I thought that i might be able to just wrap the providers in a node bu tthis doesn't work. I appreciate that I am trying to massage the structure of the xml in order to get please the path, but in doing so it will help me to target just the providers which I need to do for the options used on drop-down select.

1 Answer 1

0

This is the right way to write system.xml

<?xml version="1.0"?>
<config>
    <tabs>
        <catalog translate="label" module="catalog">
            <label>Catalog</label>
            <sort_order>200</sort_order>
        </catalog>
    </tabs>
    <sections>
        <catalog translate="label" module="catalog">
            <class>separator-top</class>
            <label>Catalog</label>
            <tab>catalog</tab>
            <frontend_type>text</frontend_type>
            <sort_order>40</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
            <groups>
                <frontend translate="label">
                    <label>Frontend</label>
                    <frontend_type>text</frontend_type>
                    <sort_order>100</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <list_mode translate="label">
                            <label>List Mode</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_catalog_listMode</source_model>
                            <sort_order>1</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </list_mode>
                    </fields>
                </frontend>
            </groups>
        </catalog>
    </sections>
</config>

You need to define tab, also use sections instead of section. You can get idea from default system.xml files.

Hope this help!

1
  • in my example I stripped out the lines of the xml which were not related to my question. Your example doesn't address the issue at hand - how to wrap the group inside a <providers> node
    – Alan A
    Jun 5, 2018 at 10:45

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.