Magento search result with full breadcumb
It is very simple.
Just alter with following code, file location /your_theme/template/page/html/breadcrumbs.phtml
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category design
* @package base_default
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* borntowinanwar@gmail.com
*/
?>
<?php
if ($product = Mage::registry(‘current_product’)) {
$categories = $product->getCategoryCollection()->load();
if($categories) {
foreach ($categories as $category)
{
if($category) {
$category = Mage::getModel(‘catalog/category’)->load($category->getId());
break;
}
}
}
$lastCrumbName = $product->getName();
$lastCategoryAdjust = 0;
}
else {
if($category = Mage::registry(‘current_category’)) {
$lastCrumbName = $category->getName();
}
$lastCategoryAdjust = 1;
}
if($category) {
if($path = $category->getPath()) {
$path = explode(‘/’, $path);
$crumbs = array(‘home’ => array(‘label’ => ‘Home’,
‘title’ => ‘Home’,
‘link’ => Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB),
‘first’ => true,
‘last’ => false
));
for($i = 2; $i < count($path) – $lastCategoryAdjust; $i++) {
$cur_category = Mage::getModel(‘catalog/category’)->load($path[$i]);
if($cur_category && $cur_category->getIsActive()) {
$crumbs[‘category’ . $path[$i]] = array(‘label’ => $cur_category->getName(),
‘title’ => $cur_category->getName(),
‘link’ => $cur_category->getUrl(),
‘first’ => false,
‘last’ => false
);
}
}
$crumbs[‘current’] = array(‘label’ => $lastCrumbName,
‘title’ => ”,
‘link’ => ”,
‘first’ => false,
‘last’ => true
);
}
}
?>
<?php if($crumbs && is_array($crumbs)): ?>
<div class=”breadcrumbs”>
<ul>
<?php foreach($crumbs as $_crumbName=>$_crumbInfo): ?>
<li class=”<?php echo $_crumbName ?>”>
<?php if($_crumbInfo[‘link’]): ?>
<a href=”<?php echo $_crumbInfo[‘link’] ?>” title=”<?php echo $this->htmlEscape($_crumbInfo[‘title’]) ?>”><?php echo $this->htmlEscape($_crumbInfo[‘label’]) ?></a>
<?php elseif($_crumbInfo[‘last’]): ?>
<strong><?php echo $this->htmlEscape($_crumbInfo[‘label’]) ?></strong>
<?php else: ?>
<?php echo $this->htmlEscape($_crumbInfo[‘label’]) ?>
<?php endif; ?>
<?php if(!$_crumbInfo[‘last’]): ?>
<span class=”glyphicon glyphicon-menu-right” aria-hidden=”true”> </span>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>