配置付款方式时,我的付款界面出现此错误
'USD', 'label'=>Mage::helper('adminhtml')->__('USD')), array('value' => 'EUR', 'label'=>Mage::helper('adminhtml')->__('EUR')), ); } } ?>
Fatal error: Call to a member function toOptionArray() on a non-object in C:\xampp\htdocs\pjsnorge2\app\code\core\Mage\Adminhtml\Block\System\Config\Form.php on line 399
并在processingCurrency.php
中class Gspay_Redirect_Model_ProcessingCurrency
{
public function toOptionArray()
{
return array(
array('value' => 'USD', 'label'=>Mage::helper('adminhtml')->__('USD')),
array('value' => 'EUR', 'label'=>Mage::helper('adminhtml')->__('EUR')),
);
}
}
感谢您的帮助
答案 0 :(得分:0)
解决上述错误。请打开上面的路径文件。
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);
}
}
请参阅此link。
答案 1 :(得分:0)
更改此文件中的以下代码app / code / core / Mage / Adminhtml / Block / System / Config / Form.php @ILLA在上面的答案,它完全有效。
if ($e->source_model)
{
$sourceModel = Mage::getSingleton((string)$e->source_model);
if ($sourceModel instanceof Varien_Object)
{
$sourceModel->setPath($path);
}
if(is_object($sourceModel))
{
if (method_exists($sourceModel, "toOptionArray"))
{
$field->setValues($sourceModel->toOptionArray($fieldType == 'multiselect'));
}
}
else
{
Mage::log($e->source_model);
}
}