Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

php

magento

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

I want to know what are the possible tags that can fit in the "global" tag of the "config.xml" page of every module's etc folder?

I have tried searching for this answer at many places in Internet but in vain.

Please provide the full details along with it for Magento version >= 1.4.0.0, because I want at least the users accessing this website find it useful enough, instead of scratching their heads.

I really want a detailed explanation, because every newbie like me gets totally confused at this point. From what I know till now, is that in this page, you can set routers, rewrites, cron jobs, admin html, front-end html and many more. But without any strong concepts, none can go ahead with the belief that his code is 100% correct w.r.t. the Magento MVC architecture.

So please I want that strong fundamental concept, getting underlined here, with a detailed explanation about it, so that no one gets into this pitfall ever again.

I can understand one thing - for many it looks that a complete reference of valid global tags of Magento would be a misnomer, but I would like to clarify that there must be a set of those valid limited number of tags that goes under the global tag.

For example, I cannot just write a "stack" or "overflow" or "joseph" tag, which I'm quite sure that it will not be taken by Magento as a valid one. It is because the valid tags (like "models", "resources", "resource" & so on) are defined somewhere in Magento configuration, that they work.

This is my point actually, which I want to emphasize.

Many many thanks to those who can answer only upon knowing the total concept clearly.

like image 635
Knowledge Craving Avatar asked Dec 04 '22 12:12

Knowledge Craving


1 Answers

The fast answer is that there is no complete list of those tags. Magento doesn't use a strict grammar for XML files because they can be extended without any trouble. Looking at the 1.4 codebase, I performed the following command from a terminal:

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

And got back about 75 lines where the global config path is invoked specifically. Some of these are simple:

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

And others are far more obscure:

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

On top of that, there are several which are invoked dynamically, such as your mentioned routers, rewrites, etc:

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

In fact, I even found 4 references in my own extension code that added to the global space. Knowing all that, a complete reference of valid global tags would be a misnomer, and will likely change even during minor updates. To your last point, you cannot go forward with complete assurance that you will be in compliance w/ Magento's configuration model. Do your best to use the objects that are provided with the library, use samples from the rest of the app when possible, and forge ahead bravely when no help is given. :)

Hope that helps!

Thanks, Joe

like image 85
Joe Mastey Avatar answered Jan 20 '23 19:01

Joe Mastey