Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

config.xml <default>
 
tman_f
Sr. Member
 
Total Posts:  85
Joined:  2008-02-12
 

Hi all,

Can somebody explain to me what the config data inside the <default> tag of any /etc/config.xml does. Here is an example:

Mage/Catalog/etc/config.xml

...
<default>
        <
catalog>
            <
frontend>
                <
list_mode>grid-list</list_mode>
                <
grid_per_page>9</grid_per_page>
                <
list_per_page>10</list_per_page>
                <
price_range_layered_navigation>1</price_range_layered_navigation>
            </
frontend>

            <
product>
                <
default_tax_group>2</default_tax_group>
            </
product>

            <
seo>
                <
product_url_suffix>.html</product_url_suffix>
                <
product_use_categories>1</product_use_categories>
                <
title_separator>-</title_separator>
            </
seo>
        </
catalog>
    </default>
...

So, where does this get used? (model, block, controller, etc)

How does it get loaded?

And, if anybody knows the answer to this question:

At what point does the config.xml file get loaded and what class/object/method does that?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
flowstack
Sr. Member
 
Avatar
Total Posts:  159
Joined:  2008-01-30
London, United Kingdom
 

There is a call to load the XML config files in /app/code/core/Mage/Core/Model/Config.php (line 114 for config.xml).

Once loaded it looks as though variables are accessed with statements such as:

Mage::getStoreConfig('catalog/frontend/grid_per_page')

Lots of Models and Helpers check the variables in the config file.

 
Magento Community Magento Community
Magento Community
Magento Community
 
tman_f
Sr. Member
 
Total Posts:  85
Joined:  2008-02-12
 

Thanks Flowstack,

So If I wanted to create a sample module say Mage/Sample

and put the following in my /etc/config.xml :

<default>
        <
sample>
            <
test>
                 <
random_data>blabla</random_data>
            </
test>
        </
sample>
    </default>

I could then access that value with the following:

Mage::getStoreConfig('sample/test/random_data');

Is that accurate?

Thanks again for your reply.

 
Magento Community Magento Community
Magento Community
Magento Community
 
flowstack
Sr. Member
 
Avatar
Total Posts:  159
Joined:  2008-01-30
London, United Kingdom
 

I reckon that would work, although I haven’t tested it! :D

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top