Magento Layout Files Reference This reference documents Magento’s layout files, i.e. the XML files in a app/design/frontend/
//layout folder. There’s a complete list of layout handles, e.g. default, for every layout file, e.g. page.xml. More importantly, this reference covers all of the XML elements, including their attributes and common values. If possible, examples are given for each element or attribute to further clarify their usage. Please Note: This is a work in progress and is currently missing descriptions for the XML elements and attributes.
1
Layout handles for each layout file bundle.xml default catalog_category_default catalog_category_view catalog_category_layered catalog_product_compare_index catalogsearch_result_index catalogsearch_advanced_result tag_product_list wishlist_index_index wishlist_shared_index catalog_product_view PRODUCT_TYPE_simple customer_account checkout_cart_index checkout_onepage_review checkout_multishipping_addresses checkout_multishipping_shipping checkout_multishipping_overview PRODUCT_TYPE_bundle sales_order_view sales_order_invoice sales_order_shipment sales_order_creditmemo sales_order_print sales_order_printinvoice sales_order_printshipment sales_order_printcreditmemo sales_email_order_items sales_email_order_invoice_items sales_email_order_shipment_items sales_email_order_creditmemo_items catalog.xml default catalog_category_default catalog_category_layered catalog_category_layered_nochildren catalog_product_compare_index customer_account_index catalog_product_view PRODUCT_TYPE_simple PRODUCT_TYPE_configurable PRODUCT_TYPE_grouped PRODUCT_TYPE_virtual catalog_product_send catalog_product_gallery catalog_seo_sitemap catalog_seo_sitemap_category catalog_seo_sitemap_product catalog_seo_searchterm_popular catalogsearch.xml 2
default catalogsearch_result_index catalogsearch_advanced_index catalogsearch_advanced_result catalogsearch_term_popular checkout.xml default checkout_cart_index checkout_multishipping checkout_multishipping_login checkout_multishipping_address_select checkout_multishipping_address_selectbilling checkout_multishipping_address_newshipping checkout_multishipping_address_newbilling checkout_multishipping_address_editshipping checkout_multishipping_address_editaddress checkout_multishipping_address_editbilling checkout_multishipping_customer_address checkout_multishipping_addresses checkout_multishipping_shipping checkout_multishipping_billing checkout_multishipping_overview checkout_multishipping_success checkout_onepage_index checkout_onepage_progress checkout_onepage_paymentmethod checkout_onepage_shippingmethod checkout_onepage_additional checkout_onepage_review checkout_onepage_success checkout_onepage_failure cms.xml default cms_page cms_index_defaultindex cms_index_defaultnoroute contacts.xml default contacts_index_index core.xml default customer.xml default customer_logged_in customer_logged_out customer_account_login customer_account_logoutsuccess customer_account_create customer_account_forgotpassword customer_account_confirmation customer_account_edit customer_account 3
customer_account_index customer_address_index customer_address_form directory.xml catalog_category_default catalog_category_layered catalogsearch_advanced_index catalogsearch_result_index catalogsearch_advanced_result downloadable.xml customer_account downloadable_customer_products checkout_cart_index checkout_onepage_review checkout_onepage_success checkout_multishipping_addresses checkout_multishipping_shipping checkout_multishipping_overview checkout_multishipping_success sales_order_view sales_order_invoice sales_order_creditmemo sales_order_print sales_order_printinvoice sales_order_printcreditmemo sales_email_order_items sales_email_order_invoice_items sales_email_order_creditmemo_items PRODUCT_TYPE_downloadable giftmessage.xml giftmessage_index_edit giftmessage_index_save giftmessage_index_remove googleanalytics.xml default googlecheckout.xml checkout_cart_index googlecheckout_redirect_redirect googleoptimizer.xml catalog_product_view catalog_category_default catalog_category_layered cms_page checkout_cart_index checkout_onepage_index checkout_onepage_success checkout_multishipping_success checkout_multishipping customer_account_create newsletter.xml default customer_account 4
customer_account_index newsletter_manage_index page.xml default print paypal.xml checkout_cart_index paypal_express_review paypal_express_review_details paypaluk.xml checkout_cart_index paypaluk_express_review paypaluk_express_review_details poll.xml default customer_account_index productalert.xml catalog_product_view reports.xml default review.xml customer_account customer_account_index reviews review_product_list review_product_view review_customer_index review_customer_view rss.xml default rss_index_index rss_index_nofeed rss_index_wishlist rss_catalog_new rss_catalog_special rss_catalog_salesrule rss_catalog_tag rss_catalog_notifystock rss_catalog_review rss_catalog_category rss_order_new rss_order_status sales.xml customer_logged_in checkout_onepage_index checkout_onepage_reorder customer_account customer_account_index sales_order_history sales_order_view sales_order_invoice sales_order_shipment 5
sales_order_creditmemo sales_order_reorder sales_order_print sales_order_printinvoice sales_order_printshipment sales_order_printcreditmemo sales_email_order_items sales_email_order_invoice_items sales_email_order_shipment_items sales_email_order_creditmemo_items sendfriend.xml sendfriend_product_send shipping.xml shipping_tracking_ajax shipping_tracking_popup tag.xml default customer_account customer_account_index catalog_product_view tag_list_index tag_product_list tag_customer_index tag_customer_view tag_customer_edit weee.xml checkout_cart_index checkout_onepage_index checkout_multishipping customer_logged_in wishlist.xml default customer_account customer_account_index wishlist_index_index wishlist_index_share wishlist_shared_index
General XML elements and attributes reference Attributes name
Example 6
bundle bundle/checkout_cart_item_renderer checkout/cart/sidebar/default.phtml
action Attributes method •
addPriceBlockType: bundle bundle/catalog_produc t_price bundle/catalog/product/price.phtml
•
addItemRender: bundle bundle/checkout_cart_item _renderer checkout/cart/sidebar/default.phtml < /action>
•
addItem: skin_js js/bundle.js
•
insert: product.info.bundle.options
•
setItemLimit: bundle 4
•
setImgSrc: <src>images/media/col_left_callout.jpg
•
setImgAlt: Our customer service is available 24/7. Call us at (800) DEMO-NUMBER.
•
setLinkUrl: checkout/cart
•
addLink: Site Map Site Map
•
setDefaultListPerPage: 4
•
setDefaultGridPerPage: 9
•
addPagerLimit: <mode>list6
•
setToolbarBlockName: product_list_toolbar
•
addReviewSummaryTemplate: default review/helper/su.phtml
•
setTemplate: page/onecolumn.phtml
•
addJs: <script>scriptaculous/scriptaculous.js
•
unsetChild: catalog_compare_sidebar
•
setTierPriceTemplate: catalog/product/view/tierprices.phtml
•
setColumnCount: 4
7
•
setItemLimit: upsell 4
•
addOptionRenderer: text catalog/product_view_options_type_text block>catalog/product/view/options/type/text.phtml
•
insert: product.tierprices
•
append: product.info.addtocart
•
setDataByKey: alias_in_layout container2
•
setDataByKeyFromRegistry: options_container product
•
unsetCallChild: container1 ifEquals 0 alias_in_lay out options_container
•
setTitle: Categories
•
bindPager: <pager>seo.sitemap.pager.top
•
setItemsTitle: categories
•
setListOrders:
•
setListModes:
•
setListCollection:
•
addCartLink:
•
addCheckoutLink:
•
setCartTemplate: checkout/cart.phtml
•
setEmptyTemplate: checkout/cart/noItems.phtml
•
chooseTemplate:
•
setMethodFormTemplate: <method>purchaseorder method>payment/form/purchaseorder.phtml
•
setInfoTemplate: <method> action>
•
setDontDisplayContainer: <param>1
•
setBlockId: footer_links
•
setHeaderTitle: Contact Us
•
setSaveMode: <mode>save
•
setGoogleCheckout: true
•
setScriptType: <scriptType>control_script
•
addCss: <stylesheet>css/reset.css
•
setPollTemplate: poll/active.phtml poll
•
addWishlistLink:
8
translate •
alt: Our customer service is available 24/7. Call us at (800) DEMO-NUMBER.
•
label: <mode>listall All
module •
catalog: Our customer service is available 24/7. Call us at (800) DEMO-NUMBER.
ifconfig •
<path>: Our customer service is available 24/7. Call us at (800) DEMO-NUMBER.
Examples bundle bundle/sales_order_items_renderer bundle/sales/order/items/renderer.phtml
type Attributes Examples <default> bundle bundle/catalog_product_price bundle/catalog/product/price.phtml
name Attributes Examples skin_js js/bundle.js
9
src Attributes Examples <src>images/media/col_left_callout.jpg Our customer service is available 24/7. Call us at (800) DEMO-NUMBER. checkout/cart
alt Attributes Examples <src>images/media/col_left_callout.jpg Our customer service is available 24/7. Call us at (800) DEMO-NUMBER. checkout/cart
url Attributes helper Products Sitemap Products Sitemap
Examples <src>images/media/col_left_callout.jpg Our customer service is available 24/7. Call us at (800) DEMO-NUMBER. checkout/cart
label Attributes Examples 10
Site Map Site Map
mode Attributes Examples <mode>list 2
limit Attributes Examples <mode>list 2
title Attributes Examples Site Map Site Map
script Attributes Examples <script>scriptaculous/scriptaculous.js <script>varien/product.js
11
params Attributes Examples
if Attributes Examples container1 ifEquals 0 alias_in_layout options_container
js lib/ds-sleight.js <params/> lt IE 7
condition Attributes Examples can_load_calendar_js
columns Attributes Examples 4
12
key Attributes Examples alias_in_layout container2
value Attributes Examples alias_in_layout container2
key_in_registry Attributes Examples options_container product
child Attributes Examples container1 ifEquals 0 alias_in_layout options_container
13
call Attributes Examples container1 ifEquals 0 alias_in_layout options_container
pager Attributes Examples <pager>seo.sitemap.pager.top
remove Attributes name
Examples
update Attributes handle
14
Examples
method Attributes Examples <method>purchaseorderpayment/form/purchaseo rder.phtml
template Attributes Examples <method>purchaseorderpayment/form/purchaseo rder.phtml
block_id Attributes Examples footer_links
prepare Attributes Examples Contact Us contacts Contact Us <prepare>true
15
urlParams Attributes Examples My Account My Account <prepare/> <position>10
position Attributes Examples My Account My Account <prepare/> <position>10
name Attributes Examples left.permanent.callout
mode Values remove | save
Attributes Examples <mode>save 16
flag Values true | false
Attributes Examples true
scriptType Values control_script | tracking_script | conversion_script
Attributes Examples <scriptType>tracking_script
pageType Values Attributes Examples <pageType>checkout_onepage
17
stylesheet Values Attributes Examples <stylesheet>css/print.css <params>media=”print”
block Attributes type This is the identifier of the module class that defines the functionality of the block. This attribute must not be modified. Values: Example:
name This is the name by which other blocks can make reference to the block in which this attribute is assigned (see diagram 3). Values: Example:
before (and) after These are two ways to position a content block within a structural block. before=”-” and after=”-” are commands used to position the block accordingly at the very top or very bottom of a structural block. Values: Example:
template This attribute determines the template that will represent the functionality of the block in which this attribute is assigned. For instance, if this attributes is assigned ‘catalog/category/view.phtml’, the application will load the ‘app/design/frontend/template/catalog/category/view.phtml template file.In order to learn about how layout works with templates to bring markup to your store, read Step by Step Guide to Building a Theme. 18
Values: Example:
action is used to control store-front functionalities such as loading or unloading of a Javascript. A full list of action methods will soon become available, but in the mean time the best way to learn about the different action methods is by playing around with them in the currently available layout updates. Values: Example:
as This is the name by which a template calls the block in which this attribute is assigned. When you see the getChildHtml(’block_name’) PHP method called from a template, you can be sure it is referring to the block whose attribute ‘as’ is assigned the name ‘block_name’. (ie. The method =$this->getChildHtml(’header’)?> in the a skeleton template correlates to ). Values: Example:
output Values: toHtml Example: <method>
Examples bundle bundle/catalog_product_price bundle/catalog/product/price.phtml
template <sales_email_order_items> bundle 19
bundle/sales_order_items_renderer bundle/email/order/items/order/default.phtml
20