Search code examples
magentoconfiguration

How to set Magento store config data programmatically?


To get store config data, I would use this code:

$data = Mage::getStoreConfig('my/path/whatever'); 

Now, how could I save to that node? I tried Alans suggestions from Override Magento Config, but it did not work for me.

Thanks!


Solution

  • Try following:

    $value = "100";
    Mage::getModel('core/config')->saveConfig('my/path/whatever', $value);
    

    OR

    $resource = $this->getResourceModel();
    $resource->saveConfig(rtrim('my/path/whatever', '/'), 1, 'default', 0);