Am new to magento I have created custom module(front & back office). So here I want to know structure/flow of depends? And how it works depending on other modules?

Can you give me brief introduction/examples for this?

Thanks in advance.


The <depends> tag should be used if you create a module that impacts an other one.
For example if you create something that affects the products you should add in your declaration file (app/etc/modules/Namespace_Module.xml) this:

    <Mage_Catalog />

This insures that your module configuration will be loaded after the Mage_Catalog configuration.
Also if on a Magento instance the catalog module is disabled you will get an error message that your module cannot be used because it depends on the catalog module and you should disable that also.
You should also add this dependency if you use in your module one of the classes in a different module.
Why is this useful? Let's say that you want to override some tag from config.xml or system.xml. Magento loads configurations from xml files by merging them and overriding the leaf nodes. If you module is loaded after an other one you can override some leaf xml node by adding in the specific xml the same path.
Here is an example. Let's say that you want to be able to allow in system configuration to change the list mode (grid/list) only at website level. You need to add in your system.xml this:

                            <show_in_store>0</show_in_store><!-- this disables it on store view level -->

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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