In the module A I need to get some data from file config.xml of modules B and C. Are there any methods or classes dedicated for this?

Especialy I need to get XML structure and values of node <default> so that I can restore default values of system configuration of modules B and C. Below is example from config.xml of Wishlist module:


As far as I know Magento loads config.xml files of all modules, so I was wondering maybe this data is already cached and can be retrieved from cache somehow? If not, how to retrieve it programaticaly?

2 Answers 2


You can get a certain node from the config like this.

$value = Mage::getConfig()->getNode('default/wishlist/general/active');

this should retrive the value of

            <active>1</active> <!-- this value -->

The problem is that it does not retrieve the value from a specific file. it gets the value from the merged config.

If you want values from a specific file, do this.

$configFile = Mage::getConfig()->getModuleDir('etc', 'Mage_Wishlist').DS.'config.xml';
$string = file_get_contents($configFile);
$xml = simplexml_load_string($string, 'Varien_Simplexml_Element');

You will have in the $xml variable the loaded xml file and your can use xpath to find a specific node.

  • The value could be retrieved from the DB if it is defined in the column path in core_config_data, too. But only in the XML's config files (this are the defaults) Jul 21, 2017 at 22:38

You can access the config.xml of any module through Mage::getConfig. All XMLs are merged into one string so you can't really specify the exact module but you can filter on tags path.

$default_xml = Mage::getConfig()

You might need to add a dependency in module A on module B and C to make sure their config.xml is loaded when you're executing above code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.