Prestashop breadcrumb - wrong path displayed on product page
-
21-12-2019 - |
Question
I have a problem with breadcrumbs on the product page, it does not show the real path of the product.
Here's how I set it on the backend:
Here's how it shows it:
My breadcrumb.tpl file:
<!-- Breadcrumb -->
{if $page_name != index}
{if isset($smarty.capture.path)}{assign var='path' value=$smarty.capture.path}{/if}
<div id="breadcrumb">
<ul class="breadcrumb">
{if $page_name!='product'}
<li>
<a href="{$base_dir}" title="{l s='return to Home'}">{l s='Home'} {$navigationPipe|escape:html:'UTF-8'} {l s='Shop'}</a>
{if isset($path) AND $path}
{if $page_name!='product'}
<span class="divider" {if isset($category) && $category->id_category == 1}style="display:none;"{/if}>
{$navigationPipe|escape:html:'UTF-8'}
</span>
{/if}
{/if}
</li>
{/if}
{if isset($path) AND $path}
{if !$path|strpos:'span'}
<li>{$path}</li>
{else}
<li class="active">{$path}</li>
{/if}
{/if}
</ul>
</div>
{/if}
<!-- /Breadcrumb -->
I've searched everywhere on the web for a solution to my problem and I couldn't find anything helpful. Please help me with this. Any advice is helpful.
Thanks!
Solution
Look into ps_category
table from your database and see if there are multiple parent declarations for all categories.
I had this problem in the past and cleaning useless rows from the table solved my problem.
OTHER TIPS
Categories are using nleft and nright, its using this algorithm:
https://en.wikipedia.org/wiki/Nested_set_model
In my case worked setting all nleft and nright to 0, then Category::regenerateEntireNtree()