在我的 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/