Jorge Jorge - 1 year ago 77
PHP Question

How to get data from Magento System Configuration

I just wandering on how I can get the configuration data for my custom module. The configuration can be set from the admin

and how to pull it in frontend?

Answer Source
$configValue = Mage::getStoreConfig('sectionName/groupName/fieldName');

sectionName, groupName and fieldName are present in etc/system.xml file of your module.

The above code will automatically fetch config value of currently viewed store.

If you want to fetch config value of any other store than the currently viewed store then you can specify store ID as the second parameter to the getStoreConfig function as below:

$storeId = 2; // ID of the store you want to fetch the value of
$configValue = Mage::getStoreConfig('sectionName/groupName/fieldName', $storeId);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download