How to get data from Magento System Configuration

后端 未结 4 1063
清酒与你
清酒与你 2021-01-30 05:19

I just wandering on how I can get the configuration data for my custom module. The configuration can be set from the admin system->configuration and how to pull

4条回答
  •  遥遥无期
    2021-01-30 05:48

    $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:

    $store = Mage::app()->getStore(); // store info
    $configValue = Mage::getStoreConfig('sectionName/groupName/fieldName', $store);
    

提交回复
热议问题