Answer the question
In order to leave comments, you need to log in
How to fix breadcrumb in Magento?
If you go directly to the page, then the breadcrumbs are like this: Главная > Славянский шкаф
And if you go to the catalog and click on the product inside the catalog, then the breadcrumbs are like this: Главная > Шкафы > Славянский шкаф
How to make breadcrumbs always look like: Главная > Название каталога > Название товара
Magento version 1.9.0.1
<?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>></span>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
Answer the question
In order to leave comments, you need to log in
Firstly, "Cabinets" is not a directory, but a category. Secondly, rarely a product is in only one category. From this follows the ambiguity of the final version of breadcrumbs if the transition occurred from the main one. Personally, my opinion breadcrumbs by default work logically - they display the real path.
But it is possible to rewrite the breadcrumbs logic for the product page and change them in case of a direct transition not from the category page. Get ids of product categories $product->getCategoryIds() and take the first one, template - page/html/breadcrumbs.phtml
PS And this is not fixed, but customized
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question