Magento is managed it Category and product page breadcrumbs
usingCategory and product page breadcrumbs using Mage_Catalog_Helper_Data
class function getBreadcrumbPath
function here magento
check Category and product object is exits in current category depends on this magento create breadcrumbs
Category and product object is exits in current category depends on this magento create breadcrumbs.
You need to write this class
You need to write this class.
firstFirst depend on current category Path
current category Path create an array
which containing a hierarchical category tree ids
hierarchical category tree ids then
$pathInStore = $category->getPathInStore();
$pathIds = array_reverse(explode(',', $pathInStore));
$categories = $category->getParentCategories();
// add category path breadcrumb
foreach ($pathIds as $categoryId) {
if (isset($categories[$categoryId]) && $categories[$categoryId]->getName()) {
$path['category'.$categoryId] = array(
'label' => $categories[$categoryId]->getName(),
'link' => $this->_isCategoryLink($categoryId) ? $categories[$categoryId]->getUrl() : ''
);
}
}
.
HOME->ALL CATEGORIES->TOPS->POLO-TOPSHOME->ALL CATEGORIES->TOPS->POLO-TOPS.
TOPS->POLO-TOPSTOPS->POLO-TOPS. that means you want only last category then
$pathInStore = $category->getPathInStore();
$pathIds = array_reverse(explode(',', $pathInStore));
$categories = $category->getParentCategories();
// add category path breadcrumb
// put All Category id in loop to remove All category from crumns
foreach ($pathIds as $categoryId) {
$categoryId= end($pathIds);
if (isset($categories[$categoryId]) && $categories[$categoryId]->getName()) {
$path['category'.$categoryId] = array(
'label' => $categories[$categoryId]->getName(),
'link' => $this->_isCategoryLink($categoryId) ? $categories[$categoryId]->getUrl() : ''
);
}
}
$breadcrumbsBlock->addCrumb('home', array(
'label'=>Mage::helper('catalog')->__('Home'),
'title'=>Mage::helper('catalog')->__('Go to Home Page'),
'link'=>Mage::getBaseUrl()
));