面包屑中缺少 Magento 产品类别

标签 magento breadcrumbs

在我的 Magento 网站的主页上,我使用以下代码添加了“最新产品” block

{{block type="catalog/product_list" category_id="2" template="catalog/product/random.phtml"}}

当点击最新产品时,有些会起作用(起作用的会显示完整的面包屑),而另一些则会导致错误: fatal error :在/var/www/vhosts/riderseyewear.net/httpdocs/app/design/frontend/fortium/default/template/page/1column-product.phtml 中的非对象上调用成员函数 getName()第80行

此处详细描述了该错误 /image/r4VYZ.png

在那个 1column-product.phtml 文件中,我转到第 80 行并进行了更改

$currentcat = Mage::registry('current_category')->getName();

$currentcat = Mage::registry('current_product')->getName();

更改此行消除了错误。但是,现在单击产品时,类别名称不会显示在面包屑中。痕迹导航显示 HOME/PRODUCT_NAME,而不是 HOME/CATEGORY_NAME/PRODUCT_NAME

如何在不收到 fatal error 的情况下显示完整的面包屑?

最佳答案

点击此链接 http://dltr.org/blog/magento/381/Magento-Force-Display-Full-Breadcrumb-Path 。 非常适合我。如果我可以为您提供更多帮助,请告诉我。

关于面包屑中缺少 Magento 产品类别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17706279/

相关文章:

.htaccess - Magento 2.2.2 错误.htaccess IfVersion 2.4

Magento - Credit Memo "Return to Stock"未更新库存可用性

wordpress - Magento - Fishpig Wordpress - 特色图片尺寸

php - Magento:根据商店进行程序化搜索

c++ - C++ 的 VSCode 面包屑导航

php - 为什么 Composer 安装不同的包?

Java Swing 面包屑组件?

php - 面包屑未添加到缓存 View 中

asp.net-mvc-3 - MVC3 导航和面包屑 - 数据驱动

css - 没有图像的三 Angular 形式面包屑