Search code examples
phpmagentosimplexmlconfigadminhtml

Magento - Add node and save module config


I try to add a node to the module config like this:

$model = Mage::getConfig()->getModuleConfig('lemike_devmode');
$model->setNode('foo/bar/baz', 'qux', true /* overwrite */);
var_dump($model); // empty Mage_Core_Model_Config_Element

But it does not create the new nodes. The $model is just empty.

What went wrong here?

After that I guess Mage::getConfig()->saveCached() is correct for saving the new node, or?


Solution

  • If is more easy to you, you could try with custom variables.

    Hope it helps. The official Doc

    Greetings.