How is the start page of System Configuration (admin/system_config/index) defined?
-
13-12-2019 - |
Question
I often notice that the start page of the system configuration (System > Configuration
in admin panel) differs from installation to installation. Instead of showing the General > General
section, I always see the section of one or another extension.
How does this happen? It's not the sort order, since it also happens in shops where General > General
is still the first tab.
And more importantly: How would you prevent this or define your own "home page" for the system configuration?
Solution
This depends on the sort_order
of the sections in the system.xml, some extensions put very low value on this making their "important" configuration open instead the "General" page
OTHER TIPS
Thanks to Zifius' answer I wrapped my head around it.
Many modules make this mistake when adding a configuration group to an existing section (here: adding "orderexport" to "advanced > admin"):
<config>
<sections>
<admin translate="label" module="export">
<label>Admin</label>
<tab>advanced</tab>
<frontend_type>text</frontend_type>
<sort_order>0</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>1</show_in_store>
<groups>
<orderexport translate="label">
where it should be just
<config>
<sections>
<admin>
<groups>
<orderexport translate="label">
The configuration files get merged, so there is no need to redefine values that already exist if you don't want to override them.
In the example above the override does not only not make sense, it actually does harm:
- the translation scope of the whole section is changed (from
module="core"
) - the
sort_order
is set to0
The tricky bit is, that the sort order of the sections does not only specify the display order within its tab, but also which section will be opened first. This way it is possible to have a section as default page that is not part of the first tab.
I am sure, in 99% this is just copy and paste development and not knowing better.
To set the default page as I want it, I'll create an own system.xml
which sets the sort_order
of an existing section to a -1
which will be lower than all the "accidental zeroes"