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?
I'd prefer to be able to do this programmatically rather than having to write something custom in the breadcrumbs phtml file
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.
You can call breadcrumbs also from xml in any custom modules layout.
<index_index...>
<reference name="breadcrumbs">
<action method="addCrumb">
<crumbName>Home</crumbName>
<crumbInfo>
<label>Home</label>
<title>Home</title>
<link>/</link>
</crumbInfo>
</action>
<action method="addCrumb">
<crumbName>Contacts</crumbName>
<crumbInfo>
<label>Custom Page</label>
<title>Custom Page</title>
</crumbInfo>
</action>
</reference>
</index_index...>