Get Free Audit

Explaining how Magento Loads and Manipulates Configuration Information. Part II (Magento Certified Developer Exam)

May 29, 2012

836 Pavel Novitsky

Explaining how Magento Loads and Manipulates Configuration Information. Part II (Magento Certified Developer Exam)

We started explaining how Magento loads and manipulates configuration information here.

The next step is writing config into cache, if it is enabled.

Our configuration is formed by now, but besides compiling this .xml file, we need to obtain data from it somehow. Let’s go back to Mage.php.

Here are the methods:


 

Their only difference is that getStoreConfig() will return the exact value while getStoreConfigFlag(), as its name suggests, returns boolean true or false. Both methods send us to Mage_Core_Model_Store::getConfig()

Igor Dragun
Partner With Us Let's discuss how to grow your business. Get a Free Quote.
Talk to Igor


If the requested information is not found in a local cache, this method will use the path stores/[store code]/[requested path]. If data is still not found, the method will use another path default/[requested path] to search in the loaded configuration. When nothing is found, method will return null.

Found data is processed via _processConfigValue() method:

• If the returned node has children, data will be stored in a local cache recursively. By the next call within a current user session there will be no need to look for a found data in the configuration.
• If the node has backend_model, this model should be requested to bring data to the required format.
• Variable of {{unsecure_base_url}}, {{unsecure_base_url}}, {{base_url}}sort are replaced by the correspondent values.

Magento 2 Development

Take your online store to the next level with BelVG Magento 2 Development

Visit the page

As a conclusion I would like to sum everything up and point out the basics.

1. All .xml files are collected into one big simpleXmlElement object

2. First, data is loaded from app/etc/*.xml and then from app/etc/modules/*.xml. Based on the module loaded information, config.xml is loaded from the etc directory of the module. If we load backend to check ACL and build menu elements, adminhtml.xml and system.xml are loaded as well. Configuration data from the database is the last one to load.

3. Any parameters, except the ones stored in app/etc/local.xml, can be overridden in config.xml of a custom module.

P.S. Even though Magento provides us with such convenient methods as Mage:: getStoreConfig() and Mage:: getStoreConfigFlag(), we can reach any element of the configuration tree with the help of Mage::getConfig()->getNode($path, $scope, $scopeCode);

Look at your final config of the Magento installation by running the following piece of code in the site root directory:


 

Read our previous posts.

Class Naming Conventions and Their Relationship with the Autoloader

The Main Magento Design Areas and More…

Magento Module Structure

Magento Codepools

magento custom development

Magento Custom Development

Take your online store to the next level with BelVG Magento Custom Development

Visit the page
Igor Dragun
Partner With Us Looking for a partner to grow your business? We are the right company to bring your webstore to success. Talk to Igor

3 Comments

  1. Thanks pavel,

    Its very helpful post. I am working on magento since 4 yrs. but don’t know this things. Thank you so much for such a useful post.

  2. This is good news for our magento developer have new challenging question Explaining how Magento Loads and Manipulates Configuration Information.

Post a new comment

BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *