当我到达System>>配置>>我的magento仪表板中的Google API出现以下错误。
Fatal error: Call to a member function toOptionArray() on a non-object in /home/dev/public_html/app/code/core/Mage/Adminhtml/Block/System/Config/Form.php on line 421
在第421行的Form.php中,有以下代码。
} else {
$optionArray = $sourceModel->toOptionArray($fieldType == 'multiselect');
}
由于
答案 0 :(得分:1)
解决上述错误。请打开上面的路径文件。
if ($e->source_model) {
$sourceModel = Mage::getSingleton((string)$e->source_model);
if ($sourceModel instanceof Varien_Object) {
$sourceModel->setPath($path);
}
$field->setValues($sourceModel->toOptionArray($fieldType == 'multiselect'));
}
将以上代码替换为以下代码:
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);
}
}