简体   繁体   English

我正在尝试在magento的产品页面上显示面包屑,但这给了我一个致命错误

[英]I'm trying to display breadcrumbs on product page in magento but it gives me a fatal error

This is the line I have put in catalog/product/view.phtml: 这是我在catalog / product / view.phtml中输入的行:

<?php echo $this->getLayout()->getBlock('breadcrumbs')->toHtml(); ?> 

And this is the error I get: 这是我得到的错误:

Fatal error: Call to a member function toHtml() on a non-object in ../catalog/product/view.phtml on line 159

Any solutions to this? 有什么解决办法吗? I am running Magento 1.4.1.1 我正在运行Magento 1.4.1.1

XML XML

Make sure you have your configuration setup in your theme's page.xml 确保在主题的page.xml中有配置设置

<block reference="header">
   <block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>
</block> 

View 视图

You need to call the HTML item itself 您需要调用HTML项本身

<?php echo $this->getChildHtml('breadcrumbs') ?>

I had this same quandary. 我有同样的困惑。 I managed to get breadcrumbs on the products page by adding the following to app/design/frontend/THEME/default/layout/calalog.xml 通过在app / design / frontend / THEME / default / layout / calalog.xml中添加以下内容,我设法在产品页面上获得了面包屑

<catalog_product_view translate="label">
    <-- existing content -->
    <reference name="content">
        <-- existing blocks -->
        <block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
            <-- existing blocks -->
            <block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>
        </block>
     </reference>
    <-- existing content -->
</catalog_product_view>

Then in catalog/product/view.phtml add the following where you would like the breadcrumbs to appear. 然后在catalog / product / view.phtml中添加以下内容,以显示面包屑。

<?php echo $this->getChildHtml('breadcrumbs') ?>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:我正在尝试在产品页面下拉列表中显示类别表中的类别名称,但显示未定义的变量,请帮帮我 - error: I'm trying to display categories names from category table in product page dropdown, but displaying undefined variable, please help me out Magento面包屑在产品页面上消失 - Magento breadcrumbs disappear on product page 我正在尝试在Joomla中添加插件,这给了我一个致命错误 - I am trying to add a plugin in Joomla and it gives me a fatal error 我正在尝试使用 php 连接到 mysql 数据库,但它给了我一个错误 - I'm trying to connect to mysql database with php, but it gives me an error 尝试在magento中创建新产品类型,出现致命错误 - Trying to create new product type in magento, getting fatal error SQLite没有给我这样的列错误,列是我要存储到表中的变量的值 - SQLite gives me a no such column error, with the column being the value of a variable I'm trying to store into the table 我试图在YII中使用GII功能,但是当我打开gii页面时它给了我错误 - I am trying to use GII feature in YII, but it gives me error when I am opening the gii page 在Magento 1.8.1.0中保存产品时出现致命错误 - Fatal Error when saving a product in Magento 1.8.1.0 Magento:加载产品集合时发生致命错误 - Magento: Fatal error on loading product collection 试图在本地上传1M文件,我收到致命错误 - Trying to upload a 1M file locally and i get a Fatal Error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM