When to put XML declarations (elements containing information) for one module in system.xml and when in config.xml?
-
03-10-2020 - |
Question
In Magento 1.9.2.4, I am seeing two XML documents in one of my modules, one is config.xml
, other one is system.xml
. What is the difference between the two, ie. what is system.xml for and what is config.xml
for (except for declaring the module version, routes, and layouts)?
Solution
Let's start with the config.xml
file: this is the module configuration file. It contains:
- module version
- block declaration and rewrite
- model declaration and rewrite
- helper declaration and rewrite
- routes/controller declaration and rewrite
- translation file declaration
- layout file declaration
- event observer declaration
- cron jobs
- database resource declaration
- default configuration values
Take note of the last point as this one is related to the system.xml
file. The only thing this file does is declaring new configuration fields under System > Configuration. You can define the default values using the config.xml
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange