17 hours ago, 4presta said:Hi.
There is a module ps_categorytree on the left menu display.
You would also have to edit ps_categorytree.php specifically the formatCategory function
Yes, I have been playing around with that file and function, but I must be doing something wrong. This is the original code of that function in PS 8.2:
private function formatCategory($rawCategory, $idsOfCategoriesInPath): array { $children = []; if (!empty($rawCategory['children'])) { foreach ($rawCategory['children'] as $k => $v) { $children[$k] = $this->formatCategory($v, $idsOfCategoriesInPath); } } return [ 'id' => $rawCategory['id_category'], 'link' => $this->context->link->getCategoryLink($rawCategory['id_category'], $rawCategory['link_rewrite']), 'name' => $rawCategory['name'], 'desc' => $rawCategory['description'], 'children' => $children, 'in_path' => in_array($rawCategory['id_category'], $idsOfCategoriesInPath), ]; }
The idea is the same as with the main menu: add a condition so that when the category ID is 12, the link is ‘www.motorola.com’. I'm not an expert in PHP code and I may not be using the correct syntax, but it should be something like this:
private function formatCategory($rawCategory, $idsOfCategoriesInPath): array { $children = []; if (!empty($rawCategory['children'])) { foreach ($rawCategory['children'] as $k => $v) { $children[$k] = $this->formatCategory($v, $idsOfCategoriesInPath); } } return [ 'id' => $rawCategory['id_category'], if($rawCategory['id_category'] == 12){ 'link' = "https://www.motorola.com"; } else { 'link' => $this->context->link->getCategoryLink($rawCategory['id_category'], $rawCategory['link_rewrite']); }, 'name' => $rawCategory['name'], 'desc' => $rawCategory['description'], 'children' => $children, 'in_path' => in_array($rawCategory['id_category'], $idsOfCategoriesInPath), ]; }
.png.022b5452a8f28f552bc9430097a16da2.png)