joomla / joomla-cms

Home of the Joomla! Content Management System
https://www.joomla.org
GNU General Public License v2.0
4.77k stars 3.65k forks source link

[4.0] possible bug: with two menus, link to category article opens in category list instead of category blog #36114

Open Scrabble96 opened 2 years ago

Scrabble96 commented 2 years ago

Steps to reproduce the issue

N.B. I am using JCE Editor, not TinyMCE, so this may be a JCE bug:

  1. Create a few articles in a category
  2. Create a new menu item of type Category Blog and select the above category in the main menu
  3. Create a new menu (it does not need to be assigned to any modules)
  4. Add a new menu item of type Category List and assign the same category as above
  5. In another article, create a link to one of the articles in the above category using insert link > Content > [your category] > Article title

Expected result

When clicking on the link, the article should open as a child of the Category Blog. [Note: If you have both menu items in a single menu, then that is what happens.]

Actual result

The link opens as a child of the Category List item in the secondary menu. It happens whichever way around the items are created.

System information (as much as possible)

Joomla 4.0.4

Additional comments

I had created a menu with the Category List item for front editors only, which is not visible to unregistered visitors, so having links attempt to go to this location results in a 'you must log in first' request.

brianteeman commented 2 years ago

This sort of thing will always happen when you have two different links pointing to the same content. iirc the one with the lowest id will be used

Scrabble96 commented 2 years ago

Actually, it seems to be the other way around: The blog is on the main menu which has menu Id 1 and the list is in another menu of id 2. The item id for the blog is 126 and the list is 127, so it seems to be using the higher id.

Scrabble96 commented 2 years ago

It doesn't do this in J3. It links to the category blog.

Scrabble96 commented 2 years ago

Could this be a feature request? To select the appropriate menu item when selecting content if two items have the same category?

brianteeman commented 2 years ago

I have no idea how it could be achieved

Scrabble96 commented 2 years ago

So how come it selects the blog item rather than the list item in J3?

brianteeman commented 2 years ago

Different router in j4

Scrabble96 commented 2 years ago

It appears to be alphabetical, so one way around this is to add an 'x' to the beginning of the unique name for the menu that you don't want used. For example, I had 'editor-menu' - visible to registered, logged-in users only, and 'mainmenu'. When I added a public link to a category item that had a category list under 'editor-menu' and a category blog under the mainmenu, it chose the editor-menu Id, resulting in a URL along the lines of /editor-menu/my-category/category-item. When I changed the unique name for the menu to 'xeditor-menu', it chose the mainmenu Id with a URL of /my-category/category-item as expected.

fballem commented 2 years ago

I think I may be experiencing the same issue as the Original Poster, but in two languages.

I have a menu item, Components, that has a description of the Components Category and links to articles in that Category. My site is in two languages (English and French) and there is a corresponding menu item on the French menu Composants.

On my site, when I first select Components from the English menu, the menu item displays as shown in Components-01. When I select the Quebec flag, the item displays as shown in Components-02. When I select the Canadian flag, I would expect to see the display as in Components-01. Instead I see the display as in Components-03. This is absolutely not the desired behaviour.

It is possible that I have done something wrong, but I don't think so. The Associations are correct, as shown by moving from 01 to 02.

Any help would be much appreciated!screen shot 2022-02-20 at 13 58 49screen shot 2022-02-20 at 13 58 49screen shot 2022-02-20 at 13 58 49


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36114.

brianteeman commented 2 years ago

For me this is the expected behaviour and should be closed.

fballem commented 2 years ago

@brianteeman - I'm not sure that this is the desired behaviour. If I have a menu item with a Category blog, then it would be best to go there. Just a thought and I can be talked out of it, but not easily.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36114.