1

I would like to have a specific and precise explanation about the layout handle of catalog/category page.

From my knowledge i know that there are three different layout handles: catalog_category_view, catalog_category_default, catalog_category_layered

If we take a look at Mage_Catalog_Model_Category::getLayoutUpdateHandle() we will see:

public function getLayoutUpdateHandle()
{
    $layout = 'catalog_category_';
    if ($this->getIsAnchor()) {
        $layout .= 'layered';
    }
    else {
        $layout .= 'default';
    }
    return $layout;
}

So catalog_category_layered is loaded when is_anchor is set to yes, otherwise the catalog_category_default is the one who will be loaded.

And what about catalog_category_view ?

In my case, in my catalog/product page i have catalog_category_view as layout handle with a layered navigation and if I set some category to is_anchor to yes, Im still always have the same layout catalog_category_view ?

3

you should have multiple handles for the category page (certainly more than 5). If you want to know which handles is used for a specific page, you can for example add the following code in a template of the page :

<?php
Zend_Debug::dump($this->getLayout()->getUpdate()->getHandles());
?>

(for example in the app/design/frontend/<your-package>/<your-theme>/template/catalog/category/view.phtml template)

The catalog_category_view should be always present in a category page because, for each action of a controller, Magento will create an handle with the name routerName_controllerName_actionName ( the action called when you are on a category page is the viewAction() of the categoryController.php of the module Mage_Catalog that have for router name catalog).

If a category is set with is_anchor to yes, it should add another handle catalog_category_layered as you mentionned.

Hope it will help.

| improve this answer | |
2
  • catalog_category_view is for all category pages
  • catalog_category_default is only for pages that have anchor set to no
  • catalog_category_layered is only for pages that have anchor set to yes
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.