2

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?

LeMike
  • 3,195
  • 5
  • 25
  • 35
  • I'm not sure what you are trying to accomplish, are you trying to add a variable to core_config_data, or register a module node? The "foo/bar/baz" format suggests you're trying the former, but the methods suggest the latter. – Jason Aug 14 '13 at 21:24
  • I like to register a module node as shown in the first snippet. – LeMike Aug 15 '13 at 06:02
  • You may want to read [Alan Storms Guide On Loading Declared Modules](http://alanstorm.com/magento_config_declared_modules_tutorial). In it he goes over the process that Magento handles automatically to load modules. The module is registered in what would be your `app/etc/modules/Lemike_Devmode.xml` file, and Magento will pull your default configuration settings from `app/code/local/Lemike/Devmode/etc/system.xml`. – Jason Aug 15 '13 at 22:55

1 Answers1

0

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

Hope it helps. The official Doc

Greetings.

Beto Castillo
  • 867
  • 9
  • 16