How it works
The settings that you're referring to are set when you save the admin panel view of the System Config.
However, these will not save if the values are set to be "inherit from parent" or from an outer scope such as Website or global.
XML configuration in the module's etc/config.xml
are the final fallback and Magento will load these if it finds nothing else saved in core_config_data
.
The problem
You're saving merely one key. If you take a look at the form POST
from saving it in the db, we're sending all possible values.
Solving
Sander's solution is correct, you want to provide the full range of settings. But my suggestion is that, unless you're overriding the default values, only values that are changed will need to be inserted into the config.
Therefore, let it fall back to the XML config as much as possible and insert only the values you need into the db config. Try to avoid calling saveConfig
in a loop as this may cause some overhead on the db.
To do this you can save individual keys, as you're doing, or en masse. Magento does this by saving structured arrays as "groups". Take a look at how they handle it in Mage_Adminhtml_System_ConfigController::saveAction
:
$section = $this->getRequest()->getParam('section');
$website = $this->getRequest()->getParam('website');
$store = $this->getRequest()->getParam('store');
Mage::getSingleton('adminhtml/config_data')
->setSection($section)
->setWebsite($website)
->setStore($store)
->setGroups($groups)
->save();
One problem I see here, though, is that saving the config doesn't necessarily mark the old config as invalidated though. This may create a problem. That admin controller goes to the trouble itself of reinit'ing the config and calling a dispatch:
// reinit configuration
Mage::getConfig()->reinit();
Mage::dispatchEvent('admin_system_config_section_save_after', array(
'website' => $website,
'store' => $store,
'section' => $section
));
Mage::app()->reinitStores();
Now, this may not apply to you or what you're doing, but it may be something to be aware of.
Best of luck!