We keep finding demand for modules that transfer a batch file to or from a remote location. Rather than create redundant code, we thought it would be a good idea to create a sharable module for handling file transfer mechanisms. But we only got as far as a little bit of helper code before we realized that we would have to code the config fields into each "user module" (what we call the modules that use the FileTransfer module). There're multiplying points-of-failure there because each config field that has to be created can be different from the others.

What we really need is a way consistently to generate the needed admin config fields.

  1. Generating actual XML seems like the wrong thing to do.
  2. In our team we discussed creating custom frontend_models in the FileTransfer module, and that's the direction we're headed in now, but that will require us to manually code all the widgets and everything for the frontend and handle the POST specially in the backend. All of that seems unnecessary since we're just trying to duplicate procedures that Magento does anyway.

What we want is to guarantee config consistency across any module that uses a component of the FileTransfer module. Any suggestions?

  • Are the configuration fields generic, or specific to each website?
    – Ryre
    Commented Mar 27, 2013 at 22:40
  • @Toast they're mostly generic. I suppose it'd be nice to be able to customize some of the helper fields, but not required.
    – kojiro
    Commented Mar 27, 2013 at 23:24

4 Answers 4


You can create admin configuration values with a system.xml file in your modules /etc/ folder. This is an example from Magento's wiki:

<?xml version="1.0"?>
    <EXAMPLE translate="label">
      <label>An Example Section</label>
  • The question is about how to programmatically generate the effect, not how to just create them once.
    – kojiro
    Commented Mar 28, 2013 at 17:42
  • By placing the code in the system.xml file, it will automatically be included anytime the module is installed. Dynamic fields aren't required (see the answer's comments).
    – Ryre
    Commented Mar 28, 2013 at 19:28
  • 1
    This looks like an example of an ordinary system.xml from any module that adds fields to core_config_data. But what I need is to have one module whose core_config_data fields are cloned and renamed by other modules.
    – kojiro
    Commented Mar 28, 2013 at 19:36
  • I think you could use the Mage_Core_Model_Config class in a setup script to to get the data, then auto-generate your XML file. That comes with it's own challenges and likely isn't the best way.
    – Ryre
    Commented Mar 28, 2013 at 19:48

To my knowledge, there is no way to extend the config model (or by association, add fields to the admin config) through PHP.

I've just done a quick dive into the config model to check things out. It doesn't dispatch any events and it doesn't extend anything that dispatches events. I also drilled through a few of its methods to see what it does when it's parsing the XML files... well, that's all it does. It doesn't hit any other objects that might be able to inject nodes into it.

Short of modifying core code, which you must absolutely not do, it doesn't look like you can programmatically add admin config fields. So, it seems like the less-than-ideal solution you're currently working towards is your only real option, sorry to say.


Do you want to change them through the gui? If not, you can just add a configuration setting for each transfert, like:


This way, you can access the configuration via Mage::getStoreConfig('namespace/fileTransfer') and this returns an array. Every element in the array is an array with the keys from and to

So you can just add new nodes <user-module2>, ... If you coded your file transfer module generic, you can add all kind of URIs, like file://, php://, ftp://, etc.

  • Sorry if my question was unclear – when I talked about "admin config" I was talking about the GUI.
    – kojiro
    Commented Apr 8, 2013 at 20:40
  • Then I think the way should be to implement your own renderer in the backend to show th pairs to and from, adding a little bit js to add new input fields and generating different xml config nodes while saving. Commented Apr 9, 2013 at 23:38

We ended up writing a Magento extension to make it easy to inject configuration.

It's fairly involved, but the idea is that another module, by observing an ActiveConfig event, can supply config fields to many different modules. For example, we use it in Magento File Transfer. See the config.xml where the event handler is registered, and the main injector implementation for how data ends up in config.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.