What are the possible tags inside the "global" tag in the Magento "config.xml" file?

Can some Magento professional experienced developer tell me how to accomplish the following in Magento?

I want to know what are the possible tags that can fit into the "global" tag of the "config.xml" page in each module folder, etc.

I tried to find this answer in many places on the Internet, but in vain.

Please provide complete information with it for Magento version> = 1.4.0.0 , because I want at least users accessing this site to find this useful enough, instead of scratching their heads.

I really need a detailed explanation, because every beginner, like me, is completely confused at this point. From what I know so far, is that on this page you can install routers, rewrites, cron jobs, admin html, front-end html and many others. But without any strong concepts, no one can go forward with the conviction that his code is 100% correct wrt of Magento MVC architecture.

So please, I want this strong fundamental concept to be emphasized here, with a detailed explanation of it, so that no one else falls into this trap.

I can understand one thing: for many it seems that a complete reference of valid Magento global tags would be wrong, but I would like to clarify that there must be a set of valid limited number of tags that fall under the global tag.

For example, I cannot just write the tag "stack" or "overflow" or "joseph", which I'm pretty sure that Magento will not be used as valid. This is because valid tags (for example, "models", "resources", "resource", etc.) are determined somewhere in the Magento configuration that they work.

This is my point that I want to emphasize.

Many thanks to those who can only answer, knowing that the general concept is clear.

+4
source share
4 answers

Quick answer: a complete list of these tags is missing. Magento does not use strict grammar for XML files because they can be expanded without any problems. If you look at the code base 1.4, I ran the following command from the terminal:

cd /path/to/magento grep -r global/ . 2>/dev/null | grep -v pearlib | grep php | sort 

And about 75 lines were returned, in which the global configuration path was specifically called. Some of them are simple:

 global/page/layouts global/pdf/totals global/template/email global/payment/cc/types 

And others are much more obscure:

 global/catalog/product/type/configurable/allow_product_types global/helpers/core/encryption_model global/widget/related_cache_types 

In addition, there are several that are called dynamically, for example, the mentioned routers, rewrite, etc .:

 global/models/'.$model.'/resourceMode global/'.$groupType.'s 

In fact, I even found 4 links in my own extension added to the global space. Knowing all this, a complete reference of valid global tags will be incorrect, and will probably change even with minor updates. By your last moment, you cannot go forward with the full confidence that you will be in accordance with the Magento configuration model. Make every effort to use the objects that are in the library, use samples from the rest of the application whenever possible, and boldly go ahead when no help is provided. :)

Hope this helps!

Thanks Joe

+7
source

In fact, it is important to remember when developing Magento that all config.xml files are combined to produce a single unique XML file containing all the nodes taken in all config.xml files of all modules .

The fact is, as Joseph said, Magento does not use strict grammar. We can say that the grammar is created by the developers themselves .

For example, if in your module your config.xml defines:

 <config> <mynode> <myconfigvar>Foo</myconfigvar> <mynode> </config> 

Any other module that defines the same node ( <mynode></mynode> ) can add a subnode to this node, and your module can also access this new node.

It is better to understand what the nodes are used for - to read the kernel code. A good way to understand how config.xml is processed magento is read app/code/Core/Mage/Core/Config.php .

Understanding how the Mage::getStoreConfig() function works is also a good way.

Hyuug.

+4
source

Instead of looking for strings that explicitly indicate individual locations, you can reset the list of existing tags. As others have pointed out, this is an ever-changing list, so it just gives you an idea. I often use a script, as in research ...

 <pre><?php require 'app/Mage.php'; Mage::app(); $global = Mage::getConfig()->getNode('global'); foreach ($global->children() as $node) { echo $node->getName(), PHP_EOL; } ?></pre> 
+4
source

As Joseph said, there is no definite list of possibilities. My suggestion for you is to just get started with your Magento config.xml files. Just open / app / code / core / Mage /, and then each folder inside there is a main module. So, sales, for example. Open Sales / etc / config.xml and see what they did.

You can find out a ton simply by looking at what Magento has already built. When I stopped trying to ask all the questions and started checking and studying code that already exists, when I really began to understand how everything works.

+2
source

Source: https://habr.com/ru/post/1309643/


All Articles