Support

Akeeba Ticket System

#33416 menu item 'Category' shows all Categories

Posted in ‘Akeeba Ticket System for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Akeeba Ticket System version
n/a

Latest post by baroen on Monday, 20 July 2020 10:17 CDT

baroen

I created a menu item 'Category' and selected one category I want to show, but instead ALL categories are shown. What can I do about this?

baroen

Extra info:
I have created a menu-item in menu: Hidden. -> categories -> alias /ingediende-klachten-en-retouren

The menu item where I want to show the single category is in mainMenu (acces: registered), alias -> /retour-en-garantie

When clicking the /retour-en-garantie menu, user gets redirected to /ingediende-klachten-en-retouren.

When I add manually to this URL /retour (name of category) I see the result I am looking for.

(hope this makes any sense ;-) )

nicholas
Akeeba Staff
Manager

That's how the SEF router works. You are trying to simultaneously fulfil two competing requirements: a canonical menu structure AND Joomla's free-form menu structure. This is not possible UNLESS all Category menu items are sub-items of the Categories menu item and use the same aliases as the respective categories.

Let me illustrate by means of a counter-example.

Imagine the following ticket structure: Components (top category) / Joomla (first level category) / Example (second level category) / #1234 Some question (ticket).

Imagine the following menu structure:

Menu item #123: Category "Joomla", alias "my-Joomla"
Menu item #140: Categories (all ATS categories), alias "support"
Menu item #153: Category "Example", alias "my-example"
Menu item #200: Category "Components", alias "my-components"

You have clicked menu item #140. Your URL is /support.html. What is the correct URL for the Example category? Is it /support/components/joomla/example.html, /my-components/joomla/example.html, /my-joomla/example.html or /my-example.html? Which one of these URLs is the canonical URL to the category? Because we need to give the canonical link at all times to avoid SEF issues.

The answer is that there is no sane answer. If you are in menu item #140, generating the URL passes Itemid=140 to the Joomla SEF router so you might think that the URL should be created as /support/components/joomla/example.html. However, menu item 140 is the wrong menu item type (Categories instead of Category) so we need to find a more specific menu item. You might now think that surely menu item 153 must be the most specific. But no. Menu item 123 comes first so you get /my-joomla/example.html instead.

If you tried the same exercise by having clicked menu item 153 your browser URL would be /my-example.html BUT the canonical URL the category would link to would again be /my-joomla/example.html.

So how do you route ticket #1234? It gets really funny because our specificity scope now changed. There are no menu items for Ticket so we need to find the most specific menu item for its category ("Example"). That would be menu item 153 so the canonical URL to the ticket is /my-example/1234:some-question.html EVEN THOUGH the canonical URL to its parent category is /my-joomla/example.html.

What I described is not a bug! It's the only reasonable way to fulfil the two opposing requirements. On one hand we are trying to have a nested structure of categories leading to a ticket. On the other hand we have a menu item structure in Joomla which undermines structure. So we have to work with specificity rules which create weird results.

It gets even worse when the specificity rules lead to a menu item with a different menu item type (view) than the one intended. If the most specific menu item is in a different menu Joomla might not report it at all, leading us to pick a different menu item, falling back to the Categories menu item. What I mean is that if menu item 140 was under the Main Menu and items 123, 153 and 200 were under the Hidden menu everything I said to this point would not apply! Instead, the URLs to the example category would always be /support/components/joomla/example.html and the URL to the ticket would be /support/components/joomla/example/1234:some-question.html. The hidden menu items would be ignored because they do NOT belong to the Joomla menu used to render the page.

So the correct menu structure is having everything in the Hidden menu, in the same structure as the ticket system categories and with the same aliases. Anything else will create results that are correct in the context of what you ask Joomla to do but totally incorrect in the context of what you expect.

This is exactly why no other CMS or framework lets the user-visible menu item structure determine the URL structure. It's INSANITY.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

baroen

Thanks for your extensive explanation. Up to creating a full hidden menu structure.

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!