I am developing a payment method module in Magento. When I click payment methods menu in Configuration of Magento I get the below error
Fatal error: Call to a member function toOptionArray() on a non-object in
\xampp\htdocs\magento\app\code\core\Mage\Adminhtml\Block\System\Config\Form.php
on line 421
Please see the below link for the code of module which I was developing
I am using Xampp 1.7.3 and magento 1.6.1. Please help.
In your system.xml you have the following code
The source model is specified as
cashondelivery/createorder
.According to the code you posted in the question you reference, this class is a payment method model, not a source model.
If you implement the
toOptionArray()
method on the model it would work as a system config source model as well, but that doesn't seem like a bad choice.I would guess the source model you are looking for is something like
paygate/authorizenet_source_paymentAction
.Background
Source models in Magento exist to provide option lists to select and multiselects. For this purpose they implement the
toOptionArray()
method.The options are returned as an array that has the following format:
System configuration source models don't need to extend super class and don't need to implement any methods besides
toOptionArray()
.EAV select and multiselect attributes also make use of source models, but those need to extend
eav/entity_attribute_source_abstract
and are more complex, so I'll won't go into more details at this place.