Event Observer
<config>
<frontend> [1]
<events>
<catalog_product_load_after> [2]
<observers>
<yourModule> [3]
<type>singleton</type> [4]
<class>module/observer</class> [5]
<method>catalogProductLoadAfter</method> [6]
</yourModule>
</observers>
</catalog_product_load_after>
</events>
</frontend>
</config>
[1] Area: adminhtml, frontend, oder, global
[2] Event Code
[3] Must be unique within the event observer.
[4] "model" or "singleton"
[5] Your_Class_Name oder module/class
[6] The method to be called on the observer instance.
Rewrite Controllers
<config>
<frontend> [1]
<routers>
<checkout> [2]
<args>
<modules>
<yourModule
before="Mage_Checkout">Namespace_Module_Overwrite_Checkout</yourModule> [3]
</modules>
</args>
</checkout>
</routers>
</frontend>
</config>
[1] Depending on the controllers area "frontend" or "admin"
[2] Router node of the module to be overridden (look it up in the config.xml of that module)
[3] The tag <yourModule> can be anything, it must be unique within the <modules> node.
Your_Module_Overwrite_Checkout (is mapped to directory)
Your/Module/controllers/Overwrite/Checkout/
Register Module Controllers
<config>
<frontend> [1]
<routers>
<yourModule> [2]
<use>standard</use> [3]
<args>
<module>Namespace_Module</module> [4]
<frontName>yourmod</frontName> [5]
</args>
</yourModule>
</routers>
</frontend>
</config>
[1] Depending on the controllers area "frontend" or "admin"
[2] Must be unique
[3] "admin" for Adminhtml controllers, otherwise "standard"
[4] Namespace and Name of the Module as defined in the <config><modules> node
[5] The URL part to point to the controller directory (e.g. http://example.com/yourmod)
Magento will look in Namespace/Module/controllers/ for the called controller.
Rewrite a Model/Block/Helper
<config>
<global>
<models|block|helper> [1]
<!-- 被重写module的简称(shorthand) -->
<sales> [2]
<rewrite>
<!-- 被重写类的后缀名 -->
<order_item>Namespace_Module_Model_Sales_Order_Item</order_item> [3]
</rewrite>
</sales>
</models|block|helper>
</global>
</config>
[1] Depending on object type "models", "helpers" or "blocks"
[2] Modul shorthand
[3] The tag is the class to override, the content is the full name of the replacement class.
Define a Model / Block / Helper module shorthand
<config>
<global>
<models> [1]
<(shorthand)> [2]
<class>Namespace_Module_Model</class> [3]
</(shorthand)>
</models>
<blocks>
<(shorthand)>
<class>(ClassName_Prefix)</class>
</(shorthand)>
</blocks>
<helpers>
<(shorthand)>
<class>(ClassName_Prefix)</class>
</(shorthand)>
</helpers>
</global>
</config>
[1] Depending on object type "models", "helpers" or "blocks"
[2] The module shorthand, must be unique for the module
[3] Classname prefix, will replace the shorthand [2] when resolving a class name.
depends
<config>
<modules>
<(NameSpace_ModuleName)>
<active>[true|false]</active>
<codePool>[core|community|local]</codePool>
<depends>
<(AnotherNameSpace_ModuleName) />
</depends>
<version>(version_number)</version>
</(NameSpace_ModuleName>
</modules>
</config>
models
<global>
<models>
<(modulename)>
<class>(ClassName_Prefix)</class>
<resourceModel>(modulename)_(resource_model_type)</resourceModel>
<(modulename)_(resource_model_type)>
<!-- definition -->
</(modulename)_(resource_model_type)>
<rewrite><!-- definition --></rewrite>
</(modulename)>
</models>
<resources>
<(modulename)_setup><!-- definition --></(modulename)_setup>
<(modulename)_read><!-- definition --></(modulename)_read>
<(modulename)_write><!-- definition --></(modulename)_write>
</resources>
</global>
Setup Resource
<global>
<!-- ... -->
<resources>
<weblog_setup>
<setup>
<module>Magentotutorial_Weblog</module>
<class>Magentotutorial_Weblog_Model_Resource_Setup</class>
</setup>
</weblog_setup>
</resources>
<!-- ... -->
</global>
fieldsets
<global>
<fieldsets>
<(page_handle?)>
<(field_name)>?</(field_name)>
</(page_handle?)>
</fieldsets>
</global>
template
<global>
<template>
<email>
<(email_template_name)
module="(modulename)"
translate="[label][,description]"
>
<!-- definition -->
<(/email_template_name)>
</email>
</template>
</global>
events
<global>
<events>
<(event_name)>
<observers>
<class>log/visitor</class>
<method>bindCustomerLogin</method>
</observers>
</(event_name)>
</events>
</global>
cronjob
<config>
<crontab>
<jobs>
<NameSpace_ModuleName>
<schedule>
<cron_expr>*/6 * * * *</cron_expr>
</schedule>
<run>
<model>NameSpace/ModuleName::cron</model>
</run>
</NameSpace_ModuleName>
</jobs>
</crontab>
</config>
Layout
<!-- default是一个handle,即在所有页面生效 -->
<default>
<block type="page/html_head" name="head" as="head">
<!-- add js -->
<action method="addJs"><script>prototype/prototype.js</script></action>
<!-- add css -->
<action method="addCss"><stylesheet>css/styles.css</stylesheet></action>
</block>
<!-- reference是对已存在的block进行替换 -->
<reference name="left">
<block type="catalog/product_compare_sidebar" before="cart_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>
</reference>
</default>
<!-- <[module]_[controller]_[action]> 指定handle的layout -->
<catalog_category_default translate="label">
<label>Catalog Category (Non-Anchor)</label>
<reference name="root">
<!-- action用来调用一个程序方法 -->
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
</catalog_category_default>
<catalog_product_index>
<!-- 将使用与catalog_category_default一样的layout,用于一份layout影响多个页面 -->
<update handle="catalog_category_default" />
</catelog_product_index>
Layout: block
<!--
"catalog/product_view"的声明方法名为分组类名(Grouped Class Names)
catalog会搜索XML的global/blocks/catalog,默认是Mage_Catalog_Block
product_view补充后缀为Mage_Catalog_Block_Product_View
-->
<block
type="catalog/product_view" <!-- block的实现代码,决定block中$this的意义 -->
name="product.info" <!-- name是layout之中被引用时的唯一标识 -->
as="product-info" <!-- 别名 -->
template="catalog/product/view.phtml" <!-- 给block套上的template -->
after="-" <!-- 顺序,代表在XX block之后 -->
output="toHtml" <!--声明用于呈现到页面上的处理函数,toHtml是默认值 -->
/>
EAV
<global>
<eav_attributes><!-- definition --></eav_attributes>
</global>
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。