Question

Mage::getStoreConfig('systemfieldsgroupsectioncode/systemfieldsgroupcode/all_products_gold_price', Mage::app()->getStore());

Can you please explain the folder path ?

Was it helpful?

Solution

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

This code is used to fetch System Configuration data. It's stored in core_config_data table's path column and value is stored in value column, that you will get in $configValue variable.

Here sectionName, groupName and fieldName values can be found in module's system.xml file.

You can also set this config values in module's config.xml file, like :

<config>
...

    <default>
        <systemfieldsgroupsectioncode>
            <systemfieldsgroupcode>
                <all_products>VALUE_HERE</all_products>
            </systemfieldsgroupcode>
            ...

        </systemfieldsgroupsectioncode>
    </default>
...

</config>

OTHER TIPS

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.

This is used to fetch the data from Magento System Configuration for the current store.

Mage::app()->getStore() this will add store code in fetch values so that you can get correct configuration values for current store this will avoid incorrect store's values because magento is also use for multiple store/views so must add store code to fetch anything in magento

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

In your case ,

systemfieldsgroupsectioncode is the sectionName

&

systemfieldsgroupcode is the groupName

&

all_products_gold_price is the fieldName

This answer is given by community user already, You can check this link for more info about configuration,

Below is the best link for understand in details of your issue.

How System Configuration Works in magento?

Mage::getStoreConfig('systemfieldsgroupsectioncode/systemfieldsgroupcode/all_products_gold_price', Mage::app()->getStore())

Its useful for getting system configuration value which are stored inside System -> Configuration and value is getting based on store base.

First Parameter is field config value and second parameter is store id.
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top