Specify specific layout updates without using the Magento admin panel

Is there a way to specify a layout update for a specific category (for example, using a category identifier) ​​without using the administration and installation control panel [Custom Design> Custom Custom Outpackment].

I'm sure I can create a module that searches for the category identifier and switches the layout based on this, but I was curious if there was a designation or some other convention for the layout files, which allows you to use this type of granular since Zend Framwork sometimes allows such naming conventions.

It is also possible that the catalog.xml file itself has additional “layouts” that allow such granularity, something more specific than <catalog_category_layered />

+5
source share
2 answers

In a standard Magento installation (1.4.2, but it should apply to everyone else) Magento displays the following Layout layouts (pens tell Magento which layouts to update XML fragments are downloaded from the package layout)

<default />
<catalog_category_layered_nochildren />
<STORE_default />
<THEME_frontend_default_default />
<catalog_category_view />
<catalog_category_layered />
<CATEGORY_4 />
<customer_logged_out />

Next layout layout

<CATEGORY_4 />

It is created based on the identifier for the category. This means that you should add to your local.xmlsomething like the following: or a custom layout XML file added through a custom module

<layouts>
    <CATEGORY_4>
        <!-- your UPDATE xml here -->
    </CATEGORY_4>
</layouts>
+16
source

When you visit a directory category, Magento loads a handle to CATEGORY_${ID}, which you can use to do exactly what you are asking for.

+2
source

All Articles