Blog

Magento Layout Handles

As a frontend developer at a digital agency that is no stranger to eCommerce, Magento’s local.xml is a best friend. Let’s face it, knowing your layout XML files is at the heart of knowing frontend Magento development and the more layout handles you know, the better — so I’d like share some with you. Want to target some specific categories, category types, products, etc. in layout files? Add a CMS block to only one product? Let’s keep our code clean by keeping it in local.xml.  Here we go —

Product Types (Commonly Known):

Simple :
<PRODUCT_TYPE_simple>

Configurable :
<PRODUCT_TYPE_configurable>

Grouped :
<PRODUCT_TYPE_grouped>

Virtual
<PRODUCT_TYPE_virtual>

Downloadable :
<PRODUCT_TYPE_downloadable>

Bundled :
<PRODUCT_TYPE_bundle>
Specific Categories:
<CATEGORY_CategoryId>

So if your category id is 25, your node would be:

<CATEGORY_25>

Specific Product:
<PRODUCT_ProductId>

So if your product id is 134, you’d write:
<PRODUCT_134>

… then perform whatever actions you’d like within the handles. Clean code that’s easy to read — just don’t forget to include comments!

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>