3

I need to find a way to add breadcrumbs to pages which are created by Layered Navigation, for instance if you'd click on a certain brand name the brand name is missing in the breadcrumbs.

You can test it here, http://www.onyourface.nl/vrouw-zonnebrillen/ and then choose a brandname on the right, so for example Prada: http://www.onyourface.nl/vrouw-zonnebrillen/l/prada

What I tried to do was coming from a different angle, I tried loading a different template for those pages so that I could add the breadcrumbs manually. I explained that angle here How to create a different template for catalog_category_layered

I thought I was close when I added the following code to the category/list.phtml

$current_category = Mage::registry('current_category')->getUrl();
$category_name = Mage::registry('current_category')->getName();

$catnamemurl = "<a href=\"" . $current_category . "\">" . $category_name . "</a>";

foreach ($_productCollection as $_product):

$brandname = Mage::getModel('catalog/product')->load($_product->getId())->getAttributeText('manufacturer');

endforeach;


//breadcrumb block stuff
$breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
$breadcrumbs->addCrumb('category', array('label'=>$catnamemurl, 'title'=>$category_name));
$breadcrumbs->addCrumb('manufacturer', array('label'=>$brandname, 'title'=>$brandname));

$breadcrumbblock = $this->getLayout()->getBlock('breadcrumbs')->toHtml();  
echo html_entity_decode($breadcrumbblock);

But then, of course, you would see the manual breadcrumbs on the category list as well, but it should only show when someone clicks on a brand name, so that's when I thought maybe if the brand name link would load a different template than the normal category list I would've solved my problem, but I never got that to work.

I would be entirely grateful if someone could help me in the right direction.

Thanks in advance and for taking the time to read this chaotic/messy thread.

1 Answer 1

1

I don't think that using layered navigation is the best solution in your case. Brands are something you might want to create landingpages for (read: categories). So I wouldn't go for a layered navigation filter, I'd set up your catalog to use subcategories under "vrouwenbrillen" and make a new category for every brand you're selling.

If you're using Magento Enterprise, you might even want to consider using smart categories, since you can then link an attribute with a specific value, in your case a brand.

Anyway, by using categories, the brandname will appear in the breadcrumbs and you could also write a category description, etc. just for that brand. Which might have an impact on your SEO.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.