0
votes

After I run compilation and enable it, flush cache and go to "System -> Configuration" I get the following error

Fatal error: Call to a member function toOptionArray() on a non-object in mysite/app/code/core/Mage/Adminhtml/Block/System/Config/Form.php on line 463

If i turn off enable flush cache and go back to configuration it works.

I tried the solution in Fatal error: Call to a member function toOptionArray() on a non-object in mysite/app/code/core/Mage/Adminhtml/Block/System/Config/Form.php on line 463

But that didnt work

Go to app\code\core\Mage\Adminhtml\Block\System\Config\Form.php

find the following on line 463

$optionArray = $sourceModel->toOptionArray($fieldType == ‘multiselect’);

and replace it with:

if(is_object($sourceModel)){
$optionArray = $sourceModel->toOptionArray($fieldType == ‘multiselect’);
} else {
Mage::log($e->source_model);
}

I want to be able to enable compilation and access configuration.

Thanks in advance for your help.

1

1 Answers

0
votes

Replace the code with

if ($e->source_model) {
    $sourceModel = Mage::getSingleton((string)$e->source_model);
    if ($sourceModel instanceof Varien_Object) {
        $sourceModel->setPath($path);
    }
    if(is_object($sourceModel)){
        $field->setValues($sourceModel->toOptionArray($fieldType == 'multiselect'));
    } else {
        Mage::log($e->source_model);
    }
}

http://indianicorange.wordpress.com/2010/10/04/fatal-error-call-to-a-member-function-tooptionarray-on-a-non-object/