本文介绍了指定类别特定的布局更新,而无需使用Magento的管理仪表板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种方法可以为特定类别指定布局更新(例如,使用类别ID),而不必使用管理仪表板,也可以设置[自定义设计>自定义布局更新].

Is there a way to specify a layout update for a specific category (e.g. using category ID) without having to use the administration dashboard, and setting a [Custom Design > Custom Layout Update].

我确定我可以创建一个模块来查找类别ID并根据该ID切换布局,但是我很好奇布局文件是否有命名或某种其他类型的约定,可以使用这种类型的粒度因为Zend Framwork有时允许这样的命名约定,所以可以进行控制.

I am sure I can create a module that looks for a category ID and switches the layout based upon that, but I was curious if there was a naming or some other type of convention for layout files that allows for this type of granular control since Zend Framwork sometimes allows such naming conventions.

也许在catalog.xml文件本身中,还存在允许这种粒度的其他布局",这比<catalog_category_layered />

Also maybe within the catalog.xml file itself there are additional "layouts" that allow such granularity, something more specific than <catalog_category_layered />

推荐答案

在标准的Magento安装(1.4.2,但应适用于其余版本)中,Magento发出以下布局句柄(句柄告诉Magento哪个布局更新XML)从程序包布局中加载的片段)

In a standard Magento install (1.4.2, but it should apply to the rest), Magento issues the following Layout handles (handles tell Magento which Layout Update XML Fragments to load 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 />

以下布局句柄

<CATEGORY_4 />

是基于类别的ID生成的.这意味着您应该能够在您的local.xml或通过自定义模块添加的自定义布局XML文件中添加以下内容

is generated based on the ID for a category. This means you should be able to add something like the following to your local.xml, or to a custom layout XML file added via a custom module

<layouts>
    <CATEGORY_4>
        <!-- your UPDATE xml here -->
    </CATEGORY_4>
</layouts>

这篇关于指定类别特定的布局更新,而无需使用Magento的管理仪表板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 17:11