在我的local.xml文件中,我有标记来覆盖产品目录页面。在2列中,在面包屑之前,我希望创建具有动态产品类别标题的自定义类别块,并根据类别名称创建描述和背景颜色。
问题是我的定制块没有出现。local.xml:
<catalog_category_view>
<reference name="root">
<action method="setTemplate">
<template>page/2columns-left.phtml</template>
</action>
<block type="core/template" name="big_header" before="content" template="boilerplate/page/html/head/big_header.phtml" />
</reference>
</catalog_category_view>样板/page/html/head/big_head er.phtml:
<h1>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</h1>当我将这个块添加到:<reference name="head">内容时,来自big_header.phtml的内容通常会出现。
我用Magento 1.7
发布于 2016-12-06 05:04:09
在主题布局文件夹中创建一个local.xml,如下所示。
<?xml version="1.0"?>
<layout version="0.1.0">
<catalog_category_view>
<reference name="root">
<action method="setTemplate">
<template>page/2columns-left.phtml</template>
</action>
</reference>
<reference name="content">
<block type="core/template" name="big_header" before="content" template="page/html/head/big_header.phtml" />
</reference>
</catalog_category_view>
</layout>创建临时模板
主题名称=>模板文件夹=>页面文件夹=> html文件夹=>头文件夹=>和big_header.phtml文件
我认为“样板”是你的主题名称。
确保您正在检查的类别页面是管理区域中的Page Layout set to "No layout updates"。
目录=>管理类别=>从左侧侧边栏=>选择您的类别,转到自定义设计选项卡和页面布局字段。
没有必要使用$this->getChildHtml('big_header');
发布于 2016-12-05 12:27:47
Magento使用core/text_list块(如content)自动呈现所有子元素。不可否认,root不是其中之一。您需要编辑模板page/2columns-left.phtml并为您的块添加一个调用。
<?php echo $this->getChildHtml('big_header') ?>
https://stackoverflow.com/questions/40973846
复制相似问题