Magento – Default Page in System Config Displays Everything But Main Content

configurationxml

  1. Can someone explain me, which page is shown as default when entering the system configuration in the backend? What is the logic behind it?

  2. Is there a cookie based "remember the last system config page you visited and show it when you come back" function or did it exist in the past? I thought there was but I am not sure anymore.

The reason I am asking is, when I enter the System Configuration, I see a blank content page and I am not sure but I think there was content there before. It seems I messed up something 🙂
But every page in the system config that I click works as expected.

Thanks in advance! 🙂

enter image description here

Best Answer

If no section request parameter is present, the currently active section is simply the first one in the ordered list of system.xml sections.

This happens in Mage_Adminhtml_Block_System_Config_Tabs::initTabs().
(I have removed parts of the method for the sake of clarity!)

public function initTabs()
{
    $current = $this->getRequest()->getParam('section');
    $configFields = Mage::getSingleton('adminhtml/config');
    $sections = $configFields->getSections($current);
    $sections = (array)$sections;
    usort($sections, array($this, '_sort'));
    foreach ($sections as $section) {
    if ((empty($current) && $sectionAllowed)) {
        $current = $code;
        $this->getRequest()->setParam('section', $current);
    }
    // ... leave out the rest of the method ...

The _sort() callback method simply sorts the sections by <sort_order> value.
So which section is sorted first?

As it happens, thats the <paypal> section, which is configured in Mage/PaypalUk/etc/system.xml!
This section has no <sort_order> node, so it is sorted to the top.

But, you may ask yourself, why isn't the section shown?

Well, the section configuration is not only missing the <sort_order> declaration, it is also missing the <show_in_default>, <show_in_website> and <show_in_store> settings.
And the default, if these are not set explicitly to be visible, is to hide the part of the user interface (code found in Mage_Adminhtml_Block_System_Config_Form::_canShowField()).

If we where to add <show_in_default>1</show_in_default> to the <paypal> section, the default page would no longer be empty, it would show the Website Payments Pro (Payflow Edition) group.

If you want a different section to show up as the default, just give it a <sort_order> that sorts before an empty string ;)

In previous versions of Magento the <paypal> section had a sort order set, and - if no custom module messed it up - the default section would be the General section from the Mage/Core/etc/system.xml file.
I believe (but don't know) that the current behavior with the blank page is a bug.

Related Topic