0
votes

I am working with a magento website. I have used a featured category to display homepage slider products. So when I click on the product it shows featured as a category in the breadcrumb.

Would it be possible not to show featured in the breadcrumb ? I want category name in the breadcrumb for the rest of categories .

Thanks Ab

3

3 Answers

1
votes

actually not getting your question but you can get some idea from here:

in page/html/breadcrumb.phtml file near line 34-36 change, $_crumbInfo['label'] to $_crumbInfo['title']

          <?php elseif($_crumbInfo['last']): ?>
          <strong><?php echo $this->htmlEscape($_crumbInfo['title']) ?></strong>

then in catalog/block/breadcrumb.php add 2 lines after

        $path  = Mage::helper('catalog')->getBreadcrumbPath();
        $currentCategory = Mage::registry('current_category');
        $metaname = $currentCategory['name'];

and change foreach loop like

   foreach ($path as $name => $breadcrumb) {
        $breadcrumb['title'] = $metaname;
            $breadcrumbsBlock->addCrumb($name, $breadcrumb);

            $title[] = $breadcrumb['label'];
        }

and check it, hope you get some idea..

1
votes

Why no simpler than that?

Try to use CSS. Your category will have an automatic and specific class for it. For example:

<li class="category4">
<strong>ARCHERY HUNTING</strong>
</li>

In this piece of code, I have a category that I created, called "Archery hunting". The code auto-created the class="category4", So, only write on your CSS:

.category4 strong { display: none; } 

And it will hide only that category.

0
votes

Instead of using

$_product->getProductUrl()

to fetch URL, use this:

$_product->unsRequestPath()->getUrlInStore(array('_ignore_category' => true))

Then you need to unset last visited category id at the end of your featured block:

Mage::getSingleton('catalog/session')->setLastVisitedCategoryId('');

This is all because key part for forming breadcrumbs is the following code:

    $categoryId = $params->getCategoryId();
    if (!$categoryId && ($categoryId !== false)) {
        $lastId = Mage::getSingleton('catalog/session')->getLastVisitedCategoryId();
        if ($product->canBeShowInCategory($lastId)) {
            $categoryId = $lastId;
        }
    }

basically, current category is determined by either URL params (hence the modified URL call), or through the session object (hence the removal of last visited category id)

so, to recapitulate, in your Featured block, instead of regular productUrl call, use the one I provided, and at the end of your featured product block listing, remove the lastVisitedCategoryId using the code I gave you