I want to create a select field in magento system.xml, and calling a model from that but getting error. My code开发者_运维百科 is...
<banner_type translate="label">
<label>Banner Type</label>
<frontend_type>select</frontend_type>
<source_model>banners/bannertype</source_model>
<sort_order>3</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<comment>(If you select banner type, then display with that type!)</comment>
</banner_type>
Error:
Fatal error: Call to a member function toOptionArray() on a non-object in /var/www/html/imran/magento/app/code/core/Mage/Adminhtml/Block/System/Config/Form.php on line 399
Magento attempting to instantiate a model class
Mage::getModel('banners/bannertype')
so it can it's toOptionArray
method. However, in your system banners/bannertype
doesn't resolve to a valid model class, so PHP complains.
精彩评论