config.xml Reference

Last modified by houtsnip on Fri, June 25, 2010 10:09
Source|Old Revisions  

This is an old revision of the document!


Path: app/code/(codepool)/(NameSpace)/(ModuleName)/etc/config.xml

Used to configure module. Defines all models, blocks, classes etc. for the specified module.

There is a separate config.xml file for each module. However all the files are merged together during the parsing process. This means that the module name is repeated as an XML element name (represented below as <(modulename)>) several times through the file. It also means that it is important to follow the Magento naming conventions for user-defined XML elements (e.g. <(modulename)_setup>).

Structure

  1. <config>
  2.     <modules>
  3.          <(NameSpace_ModuleName)>
  4.              <version>version</version>
  5.              <depends>
  6.                  <(AnotherNameSpace_ModuleName) />
  7.                  <(YetAnotherNameSpace_ModuleName) />
  8.              </depends>
  9.          </(NameSpace_ModuleName>
  10.     </modules>
  11.     <global>
  12.         <models></models>
  13.         <resources></resources>
  14.         <blocks></blocks>
  15.         <(newproduct)><!-- config values --></(newproduct)>
  16.     </global>
  17.     <adminhtml>
  18.         <menu></menu>
  19.         <acl></acl>
  20.         <events></events>
  21.         <translate></translate>
  22.     </adminhtml>
  23.     <frontend>
  24.         <routers></routers>
  25.         <events></events>
  26.         <translate></translate>
  27.         <layout></layout>
  28.     </frontend>
  29.     <default>
  30.         <config_vars><!-- config values --></config_vars>
  31.     </default>
  32. </config>

Specification

Element Description
config Root element

Child elements

Element Description
modules Used to define basic information about each module such as version number, dependencies on other modules
global
adminhtml
frontend
default

modules

global

Structure
  1.     <global>
  2.         <fieldsets>
  3.             <(fieldset_name)>
  4.                 <(field_name)>?</(field_name)>
  5.             </(fieldset_name)>
  6.         </fieldsets>
  7.         <blocks>
  8.             <(modulename)>
  9.                 <class>(ClassName_Prefix)</class>
  10.             </(modulename)>
  11.         </blocks>
  12.         <models>
  13.             <(modulename)>
  14.                 <class>(ClassName_Prefix)</class>
  15.                 <resourceModel>(modulename_resource_handle)</resourceModel>
  16.                 <(modulename_resource_handle)><!-- resource model --></(modulename_resource_handle)>
  17.                 <rewrite><!-- rewrite --></rewrite>
  18.             </(modulename)>
  19.         </models>
  20.         <resources>
  21.             <(modulename)_setup><!-- definition --></(modulename)_setup>
  22.             <(modulename)_read><!-- definition --></(modulename)_read>
  23.             <(modulename)_write><!-- definition --></(modulename)_write>
  24.         </resources>
  25.         <template>
  26.             <email>
  27.                <checkout_payment_failed_template translate="label" module="sales">
  28.                    <label>Payment Failed</label>
  29.                    <file>payment_failed.html</file>
  30.                    <type>html</type>
  31.                </checkout_payment_failed_template>
  32.             </email>
  33.         </template>
  34.     </global>

adminhtml

frontend

Structure
  1.     <frontend>
  2.         <secure_url>
  3.             <(page_handle)>/relative/url</page_handle>
  4.         </secure_url>
  5.         <events>
  6.             <(event_name)>
  7.                 <observers><!-- observers --></observers>
  8.             </(event_name)>
  9.         </events>
  10.         <routers>
  11.             <(modulename)>
  12.                 <use>[standard|admin|default]</use>
  13.                 <args>
  14.                     <module>(NameSpace_ModuleName)</module>
  15.                     <frontName>(frontname)</frontName>
  16.                 </args>
  17.             </(modulename)>
  18.         </routers>
  19.         <translate>
  20.             <modules>
  21.                 <(NameSpace_ModuleName)>
  22.                     <files>
  23.                         <default>(name_of_translation_file.csv)</default>
  24.                     </files>
  25.                 </(NameSpace_ModuleName)>
  26.             </modules>
  27.         </translate>
  28.         <layout>
  29.             <updates>
  30.                 <(modulename)>
  31.                     <file>(name_of_layout_file.xml)</file>
  32.                 </(modulename)>
  33.             </updates>
  34.         </layout>
  35.     </frontend>

default




 

Magento 2 GitHub Repository

Magento Job Board - Some sort of tag line goes here

Latest Posts| View all Jobs