If you ever need custom layout handles in your local.xml, it’s fairly simple. In this example, the observer method will make a new handle for categories that have children or not, but you can just modify the method to make whatever handle you desire. (I realized after creating this there’s already a handler for anchored categories with no subcategories,catalog_category_layered_nochildren
)
First, add this to your config.xml in yourcustommodule:
<config> <frontend> <events> <controller_action_layout_load_before> <observers> <yourcustomtheme_observer> <class>yourcustomtheme/observer</class> <method>addHandles</method> </yourcustomtheme_observer> </observers> </controller_action_layout_load_before> </events> </frontend> </config>
Then add this method to your observer:
class YourPackage_YourCustomTheme_Model_Observer extends CLS_Core_Model_Abstract { public function addHandles($observer) { $category = Mage::registry('current_category'); if ($category instanceof Mage_Catalog_Model_Category) { $update = Mage::getSingleton('core/layout')->getUpdate(); $fertilility = (count($category->getChildrenCategories()->getData())) ? 'parent' : 'nochildren'; $update->addHandle('catalog_category_' . $fertilility); } return $this; } }