Retrieve Magento Core Configuration variables on the Magento frontend
Magento has a vast configuration table (core_config_data in your database) that is managed in the Magento admin under System > Configuration. Occasionally you might need to find the value of a core configuration variable to do something on the fronted of your Magento store. To do this you can use the Magento Mage::getStoreConfig() method.
Here is an example where we get the value of the Logo Image Src found in System > Configuration > Design > Header:
// Get the logo from the current store config
$logoSrc = Mage::getStoreConfig('design/header/logo_src');
This will return something like "images/logo.gif" which you can then use to pull the logo wherever you want. This way if your logo is ever changed to say, ""images/logo.jpg", you don't have to hunt through all your templates to replace the .gif extension with .jpg. The value will be updated instantly when you save your configuration.
The "design/header/logo_src" matches the path column in the core_config_data table in the database. You can use the path value to load the value of any config row.
Example: we need to find out what language locale the current store is using. We can do this by getting the value for the general/locale/code path:
$locale = Mage::getStoreConfig('general/locale/code');
For English stores this will return something like: en_US.
I hope this makes sense and is useful to someone. Any questions or problems, please post in the comments!



November 24th, 2010 - 15:23
Thanks for the tip! It pointed me into the right direction to change some Magento email templates.
February 14th, 2011 - 04:51
it is so easy to retrieve data from backend config
thank you so much