Toulousain Posted March 13, 2022 Share Posted March 13, 2022 (edited) Hello, The breadcrumb is displayed twice in a row when I set an override of the getBreadcrumbLinks() function in the ProductController.php file. If I disable the getBreadcrumbLinks() function of the override the breadcrumb display is correct. I specify that I did not modify the getBreadcrumbLinks() function placed in the override it is the native function of prestashop. Do you know what can cause this problem and how to correct it? Thanks a lot Here is the function that causes the problem public function getBreadcrumbLinks() { $breadcrumb = parent::getBreadcrumbLinks(); $categoryDefault = new Category($this->product->id_category_default, $this->context->language->id); foreach ($categoryDefault->getAllParents() as $category) { if ($category->id_parent != 0 && !$category->is_root_category && $category->active) { $breadcrumb['links'][] = [ 'title' => $category->name, 'url' => $this->context->link->getCategoryLink($category), ]; } } if ($categoryDefault->id_parent != 0 && !$categoryDefault->is_root_category && $categoryDefault->active) { $breadcrumb['links'][] = [ 'title' => $categoryDefault->name, 'url' => $this->context->link->getCategoryLink($categoryDefault), ]; } $breadcrumb['links'][] = [ 'title' => $this->product->name, //'title' => $this->getProductPageTitle(), 'url' => $this->context->link->getProductLink($this->product, null, null, null, null, null, (int) $this->getIdProductAttributeByRequest()), ]; return $breadcrumb; } Edited March 13, 2022 by Toulousain solved (see edit history) Link to comment Share on other sites More sharing options...
Ress Posted March 13, 2022 Share Posted March 13, 2022 (edited) Hi, Try to edit first line, $breadcrumb = FrontController::getBreadcrumbLinks(); Edited March 13, 2022 by Ress (see edit history) 1 1 Link to comment Share on other sites More sharing options...
Toulousain Posted March 13, 2022 Author Share Posted March 13, 2022 Hello Ress, +1 for you. Your answers are simple, fast and effective. Your solution is the right one. It works very well. Thanks 1 Link to comment Share on other sites More sharing options...
DutchPresta Posted August 11, 2023 Share Posted August 11, 2023 On 3/13/2022 at 6:02 PM, Ress said: Hi, Try to edit first line, $breadcrumb = FrontController::getBreadcrumbLinks(); Perfect solution thank you! 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