TimTamTom Posted October 4, 2016 Share Posted October 4, 2016 (edited) Hey there guys, I have a problem with the breadcrumb in Prestashop 1.6.x Some of my products are categorised for both women (category 1) and men (category 2), however if the default category is women and you view the product through men, the breadcrumb will show Home > Women > Product. Of course this is not ideal as men want to return to the Men's category and not the Women's. So the breadcrumb should show the previous category someone has visited rather than the default category of the product. Should be somewhere in this code of the breadcrumb.tpl and a controller...?: <div class=" breadcrumb breadcrumb-links"> <a class="home" href="{$base_dir}" title="{l s='Return to Home'}"><i class="icon-home"></i> {l s='Home'}</a> {if isset($path) AND $path} <span class="navigation-pipe" {if isset($category) && isset($category->id_category) && $category->id_category == 1}style="display:none;"{/if}></span> {if $path|strpos:'span' !== false} <span class="navigation_page">{$path|@replace:'<a ': '<span itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a itemprop="url" '|@replace:'data-gg="">': '><span itemprop="title">'|@replace:'</a>': '</span></a></span>'}</span> {else} {$path} {/if} {/if} </div> Thanks for any help!! Edited October 4, 2016 by TimTamTom (see edit history) Link to comment Share on other sites More sharing options...
TimTamTom Posted November 21, 2016 Author Share Posted November 21, 2016 Could still use help with this... Anyone?! Link to comment Share on other sites More sharing options...
rocky Posted November 28, 2016 Share Posted November 28, 2016 This should already be working as long as your server is setting the HTTP referrer correctly. It's lines 139-153 (in PrestaShop v1.6.1.9) of controllers/front/ProductController.php that does it: // If the previous page was a category and is a parent category of the product use this category as parent category $id_object = false; if (isset($regs[1]) && is_numeric($regs[1])) { $id_object = (int)$regs[1]; } elseif (isset($regs[5]) && is_numeric($regs[5])) { $id_object = (int)$regs[5]; } if ($id_object) { $referers = array($_SERVER['HTTP_REFERER'],urldecode($_SERVER['HTTP_REFERER'])); if (in_array($this->context->link->getCategoryLink($id_object), $referers)) { $id_category = (int)$id_object; } elseif (isset($this->context->cookie->last_visited_category) && (int)$this->context->cookie->last_visited_category && in_array($this->context->link->getProductLink($id_object), $referers)) { $id_category = (int)$this->context->cookie->last_visited_category; } } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now