MKZ Industries Posted Tuesday at 07:41 AM Share Posted Tuesday at 07:41 AM Hi all, I would like to set up a subcategory so that when the user clicks on it, they are redirected to an external web page (in a new tab if possible). For example, if I have the following category tree: Mobile phones - Motorola - Samsung I would like the subcategories to lead to the Motorola or Samsung page. Is this possible? I have seen some very old answers that involved modifying the file "modules/blocktopmenu/blocktopmenu.php", but I do not see that module or file in Prestashop 8.2. Thank you very much and best regards! Link to comment Share on other sites More sharing options...
ComGrafPL Posted Tuesday at 07:44 AM Share Posted Tuesday at 07:44 AM Have you tried with simple link redirect? Link to comment Share on other sites More sharing options...
MKZ Industries Posted Tuesday at 12:19 PM Author Share Posted Tuesday at 12:19 PM 4 hours ago, ComGrafPL said: Have you tried with simple link redirect? Do you mean doing it directly in the htaccess file? Yes, that's an option, but if you hover your cursor over the link, ‘www.motorola.com’ (or whatever it is) won't appear, and I'm sure Google really likes these things. Link to comment Share on other sites More sharing options...
MKZ Industries Posted Tuesday at 01:10 PM Author Share Posted Tuesday at 01:10 PM (edited) Based on my research in other answers, I have tried this in "modules\ps_mainmenu\ps_mainmenu.php" in the function "generateCategoriesmenu" and it seams it is working but only for the Main Meny bar, not for the category tree: foreach ($categories as $key => $category) { $node = $this->makeNode([]); if ($category['level_depth'] > 1) { $cat = new Category($category['id_category']); if ((int)$cat ->id_category == 12) $link = "https://www.motorola.com"; else $link = $cat->getLink(); // Check if customer is set and check access if (Validate::isLoadedObject($this->context->customer) && !$cat->checkAccess($this->context->customer->id)) { continue; } } else { $link = $this->context->link->getPageLink('index'); } Any ideas of how to make it work for the category tree? Edited Tuesday at 01:18 PM by MKZ Industries (see edit history) 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