$configValue = Mage::getStoreConfig('sectionName/groupName/fieldName');
sectionName, groupName and fieldName are present in etc/system.xml file of your module.$testSwitch = new Mage_Core_Model_Config();
/*
*turns notice on
*/
$testSwitch ->saveConfig('design/head/demonotice', "1", 'default', 0);
/*
*turns notice off
*/
$testSwitch ->saveConfig('design/head/demonotice', "0", 'default', 0);
Well explained at http://inchoo.net/ecommerce/magento/how-to-programmatically-change-magentos-core-config-data/
Get the core config data collection that match the path and update new path:
try {
$path = 'old';
$collection = Mage::getModel('core/config_data')->getCollection()
->addFieldToFilter('path', array('like' => $path . '/%'));
if ($collection->count() > 0) {
foreach ($collection as $coreConfig) {
$oldPath = $coreConfig->getPath();
$newPath = str_replace("old", "new", $oldPath);
$coreConfig->setPath($newPath)->save();
}
}
} catch (Exception $e) {
Mage::log($e->getMessage(), Zend_Log::ERR);
}
Read more about Core Config data at http://alanstorm.com/magento_loading_config_variables
No comments:
Post a Comment