tumil Posted September 7, 2018 Share Posted September 7, 2018 (edited) Hello! I am trying to make some custom changes to breadcrumbs so I'm trying to edit the getBreadcrumbLinks() method in ProductController.php. What I need is to get IDs from more categories than just the default one. The code which is in the current code is: $categoryDefault = new Category($this->product->id_category_default, $this->context->language->id); How can I achieve that? I tried to add a new element in the ProductControllerCore. An array which would take the necessary IDs from Product.php in the init() method. But that didn't go well and I've ran out of ideas how to do it properly. I would appreciate any help, thanks! Edited September 10, 2018 by tumil (see edit history) Link to comment Share on other sites More sharing options...
Knowband Plugins Posted September 7, 2018 Share Posted September 7, 2018 Hi, Use getCategories() function of the product class to get the all categories of the product like $categories = $this->product->getCategories(); & after that loop through each category using the function which you mentioned to get the name & other details of the categories. $categoryDefault = new Category($category_id, $this->context->language->id); 1 Link to comment Share on other sites More sharing options...
tumil Posted September 10, 2018 Author Share Posted September 10, 2018 Much thanks! That's what I was looking for Link to comment Share on other sites More sharing options...
Hamendra Sunthwal Posted August 7, 2020 Share Posted August 7, 2020 This is not working for me i have tried $allcat = $prestashopProductClass->getCategories(); foreach($allcat as $catdata){ $categoryDefault = new Category($catdata, 1); print_r($categoryDefault); } exit; any thoughts on this ? 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