Fetching and updating magento config data

Source: Internet
Author: User
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');

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.