We can get system configuration values using


But how can we set such configuration field programatically? I would expect some method like

Mage::setStoreConfig($xmlPath, $val);

But the closest thing I'm seeing is

    ->setConfig($xmlPath, $val);

But this is not updating the config value. Thanks for your time and help.

1 Answer 1


This should work

*turns notice on
Mage::getConfig()->saveConfig('design/head/demonotice', '1', 'default', 0);
*turns notice off
Mage::getConfig()->saveConfig('design/head/demonotice', '0', 'default', 0);
class Mage_Core_Model_Config

     * Save config value to DB
     * @param string $path
     * @param string $value
     * @param string $scope
     * @param int $scopeId
     * @return Mage_Core_Store_Config
    public function saveConfig($path, $value, $scope = 'default', $scopeId = 0)
        $resource = $this->getResourceModel();
        $resource->saveConfig(rtrim($path, '/'), $value, $scope, $scopeId);

        return $this;


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.