Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Custom Backend Model
 
franky999
Jr. Member
 
Avatar
Total Posts:  12
Joined:  2008-04-01
Netherlands
 

Hey!

I’m trying to create a custom backend model that handles a file upload and has the file’s contents as its “value.”

I have this in the appropriate section of my module’s system.xml:

<keyfile translate="label">
    <
label>Key File</label>
    <
frontend_type>image</frontend_type> <!-- I know this one is wrong -->
    <
backend_model>mymodule/backend_keyfile</backend_model>
    <
sort_order>30</sort_order>
    <
show_in_default>1</show_in_default>
    <
show_in_website>1</show_in_website>
    <
show_in_store>0</show_in_store>
</
keyfile >

The class called “Myprefix_Mymodule_Model_Backend_KeyFile” is located in “app/code/local/Myprefix/Mymodule/Model/Backend/KeyFile.php” yet when I try to visit the associated configuration page, I always get this error: <b>Invalid config field backend model: mymodule/backend_keyfile</b>.

The module’s other models load fine, and the other configuration settings work normally. Please advise.

 
Magento Community Magento Community
Magento Community
Magento Community
 
franky999
Jr. Member
 
Avatar
Total Posts:  12
Joined:  2008-04-01
Netherlands
 

Ah, never mind. Forgot case-sensitivity. Used mymodule/backend_keyFile instead and it worked.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Michae1
Enthusiast
 
Total Posts:  826
Joined:  2007-08-31
 

Hi franky999,
Your backend model should extend Mage_Core_Model_Config_Data. Otherwise it won’t let you use it.

 
Magento Community Magento Community
Magento Community
Magento Community
 
franky999
Jr. Member
 
Avatar
Total Posts:  12
Joined:  2008-04-01
Netherlands
 

Yup! Figured that much out. smile Cheers!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top