致命错误:调用成员函数toOptionArray() [英] Fatal error: Call to a member function toOptionArray()
本文介绍了致命错误:调用成员函数toOptionArray()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我从我的magento仪表板进入System >> COnfiguration >> Google API时,出现以下错误消息。
致命错误:在421行上的/home/dev/public_html/app/code/core/Mage/Adminhtml/Block/System/Config/Form.php中的非对象上调用成员函数toOptionArray()
在第421行的Form.php中有以下代码。
} else {
$ optionArray = $ sourceModel-> toOptionArray($ fieldType =='multiselect');
谢谢
解决方案
解决上述错误。请打开上面的路径文件。
if($ e-> source_model){
$ sourceModel = Mage: :getSingleton((字符串)$ 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);
查看全文