本文共 1093 字,大约阅读时间需要 3 分钟。
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_data in particular 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 could 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 function getStoreConfig() and entering the path as the only argument.
echo Mage::getStoreConfig('general/store_information/name');
转载地址:http://ppcli.baihongyu.com/