Fetching and updating magento config data03 10
2011 0
Viet Le Quang
In magnto, it's easy to Update Configuration data for a store through the admin interface, or by going into the database itself and making the changes (after getting your head round EAV ). the table
Core_config_dataIn particle holds a lot of this information. There is also a way of doing this via PHP/MySQL by using magento's own inbuilt functions.
The function accepts only a few arguments:Saveconfig (pathtodata, value, websitescope, scopeid);
The example below shows updating the default store name, first by initiating the core config model, then by applying the function.
$updateconfigdata = new Mage_Core_Model_Config();$updateconfigdata->saveConfig('general/store_information/name', "My New Store Name", 'default', 0);
This cocould come in useful if you need to make config changes based on user input on the frontend (though no uses come immediately to mind ).
It's easy to get config data using the functionGetstoreconfig ()And entering the path as the only argument.
echo Mage::getStoreConfig('general/store_information/name');