问题描述
当用户在magento的前端导航自己的模块时,我想显示面包屑,该站点已经有适当的面包屑代码,按照标准的magento面包屑在其他地方使用.
I want to display breadcrumbs while a use navigates my own module on the frontend of magento, the site already has the appropriate breadcrumb code in place thats used elsewhere as per standard magento breadcrumbs.
我需要在模块中执行什么操作以指定当前的面包屑路径?
What do I need to do in my module to specify the current breadcrumb path?
我希望能够以编程方式执行此操作,而不必在面包屑phtml文件中编写自定义内容
I'd prefer to be able to do this programmatically rather than having to write something custom in the breadcrumbs phtml file
推荐答案
您可以在_prepareLayout
函数的自定义块文件中调用如下所示的面包屑.
you can call breadcrumbs like below in your custom block file in your _prepareLayout
function.
if ($breadcrumbs = $this->getLayout()->getBlock('breadcrumbs')) {
$breadcrumbs->addCrumb('home', array('label'=>$helper->__('Home'), 'title'=>$helper->__('Go to Home Page'), 'link'=>Mage::getBaseUrl()));
$breadcrumbs->addCrumb('product_list', array('label'=>$helper->__('Brands'), 'title'=>$helper->__('Brands'), 'link'=>Mage::getUrl('brands')));
$breadcrumbs->addCrumb('product_detail', array('label'=>Mage::getModel('inic_brand/brand')->getBrandName($brand->getBrand(), Mage::app()->getStore()->getId()), 'title'=>$brand->getIdentifier()));
}
希望这一定会对您有所帮助.
hope this will be sure help to you.
这篇关于如何将项目添加到magento面包屑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!