My application is configurable, so I have a few settings in the system.xml file. One of the setting uses a custom adminhtml dropdown source model.

So, in the XML, I have defined the setting row like this:

<store_id translate="label">
    <label>Select Store View</label>
    <comment>Select the store view that is used for the integration.</comment>

So, I have created the dropdown source model Stores.php here:


This file's contents are:

class Mycompany_Mymodule_Adminhtml_Model_System_Config_Source_Dropdown_Stores
    public function toOptionArray()
        // Build Option Array
        $optionArray = array();
        foreach (Mage::app()->getStores() as $store) {
            $optionArray[] = array(
                'value' => $store->getId(),
                'label' => Mage::helper('mymodule')->__($store->getName())

        // Finished
        return $optionArray;

My config.xml section for defining the models looks like this:


This was working fine before. I could go into System -> Config and click on my module tab and I could see a dropdown list of stores.

Today, this isn't working & I am not sure why. I get the following error:

Fatal error: Call to a member function toOptionArray() on boolean in /home/www-data/public_html/includes/src/Mage_Adminhtml_Block_System_Config_Form.php on line 463

Any ideas what might have gone wrong? If I comment out the config section row in the system.xml the config page works in the backend.


From looking in your part of the config.xml codes I can see module calling problem in system.xml


Change to


And also change the path of your this file and change class name as well:

class Mycompany_Mymodule_Model_System_Config_Source_Dropdown_Stores

Magento strongly follows folder and file structure. You should match it's requirement exactly to be able to get it work.


Magento module folder structure should be this:


This means your adminhtml cannot come before model or block or etc folders. It should/must go inside them.

To your problem

When declaring a source model for a field in system.xml, Magento will try to retrieve the options for the field by calling:

Mage::getModel('source model here')->toOptionArray();

So in your case it tries :


and returns null.

If I changed it like you said, then the file's location must be moved. I tried it anyway and still same error.

Then there is something wrong in your Model/System/Config/Source/Dropdown/Stores.php file. Try replacing this function and see if that works for debugging:

public function toOptionArray()
        return array(
            //array('value'=>'', 'label'=>''),
            array('value'=>'grid', 'label'=>Mage::helper('adminhtml')->__('Grid Only')),
            array('value'=>'list', 'label'=>Mage::helper('adminhtml')->__('List Only')),
            array('value'=>'grid-list', 'label'=>Mage::helper('adminhtml')->__('Grid (default) / List')),
            array('value'=>'list-grid', 'label'=>Mage::helper('adminhtml')->__('List (default) / Grid')),
| improve this answer | |
  • P.s is there a built in dropdown source I could use (like the adminhtml yes/no) to retrieve a list of stores configured in the magento rather than implementing it myself? – Latheesan Feb 5 '16 at 12:42
  • Actually, I did some digging around turns out there is a built in store list model. See my answer. – Latheesan Feb 5 '16 at 12:51

I have solved it. I did not implement my own custom dropdown source model, instead I used one of the built in ones. This is what I did:





and voilà, it works. This is good enough for me, I don't need to re-invent the wheel to get a dropdown list of store id => name.

| improve this answer | |

Fatal error: Call to a member function toOptionArray() on boolean in /home/www-data/public_html/includes/src/Mage_Adminhtml_Block_System_Config_Form.php on line 463

Above error is coming because your compilation is enable. So please follow bellow steps

  1. Go admin side System > Tools > Compilation page and click on Disable button.
  2. Go admin side System > Cache Management screen and use Flush Cache button.
  3. Now check again.
| improve this answer | |

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.