Amsive

PUBLISHED: Apr 2, 2015 1 min read

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!

Share: