No Code Attached Yet bug
avatar TLWebdesign
TLWebdesign
5 May 2020

Steps to reproduce the issue

  • Create a top level category blog view.
  • Create sub menu items under this menu item with same category but with tags filtering the category.
  • Force Route::() with the top level menu item id. like this:
    $link = Route::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language).'&Itemid=129');

Expected result

The article links inside the category blog view top level and submenu items to use itemid 129 for URL. So opening the items as if you are in the top level menu item. even when you are in one of the submenu items.

Actual result

In the submenu items it works fine. But the top level menu uses the last item in the submenu regardless of it being the highest menu item id. It takes sorting into account and just uses the last menu item id to build the link instead of the forced 129 (top level menu item)

System information (as much as possible)

Joomla 3.9.18
category blog layout override

Additional comments

even when not forcing a menu item id it still uses the last menu subitem to build the url.
attached a schematic of the menu how it is built to clarify stuff.

Schermafbeelding 2020-05-05 om 10 49 45

avatar TLWebdesign TLWebdesign - open - 5 May 2020
avatar joomla-cms-bot joomla-cms-bot - change - 5 May 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 5 May 2020
avatar TLWebdesign
TLWebdesign - comment - 1 Jul 2020

It's been almost 2 months and no activity. How come?

avatar richard67
richard67 - comment - 1 Jul 2020

@Hackwar Could you have a look on this issue here since it seems to be related to routing?

avatar Hackwar Hackwar - change - 20 Feb 2023
Labels Added: No Code Attached Yet bug
Removed: ?
avatar Hackwar Hackwar - labeled - 20 Feb 2023
avatar Hackwar Hackwar - change - 18 Mar 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-03-18 09:10:00
Closed_By Hackwar
avatar Hackwar Hackwar - close - 18 Mar 2024
avatar Hackwar
Hackwar - comment - 18 Mar 2024

Sorry for the late reply. I understand what you want to do, but this currently is actually expected behavior. The Itemid should not be forced for an otherwise complete URL, but instead the router should decide the Itemid. The downside to your approach is, that you have to not only modify the layout of the category blog, but also edit all other layouts which could generate the URL, for example modules or from smart search. Otherwise the same content would be reachable via more than one URL. That is why the core wont change this behavior.

If you want to have this changed for your site, you could create a plugin which removes the MenuRules rule from the content component router and replace it with your customised version of that behavior rule.

Since this is expected behavior, I'm closing this issue.

Add a Comment

Login with GitHub to post a comment