Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the category ID in the URL - is not honoured and breaks routing #547

Open
shoulders opened this issue Jan 16, 2022 · 0 comments
Open

Comments

@shoulders
Copy link

Joomla: 3.10.4
K2: 2.10.3

How I found this.

After I upgraded to K2 v2.10.3 when i searched for the article Configure OpenWRT on a BT Home Hub 5 / Plusnet One Router as a Secure WiFi Client it found the article with the link. (p.s. just search for Secure WiFi Client)

https://quantumwarp.com/kb/articles/37-kb/2-hardware/dsl-broadband/950-configure-openwrt-on-a-bt-home-hub-5-plusnet-one-router-as-a-secure-wifi-client

But when I click on the link I am redirected to that page but I am showing the content from the article Bios Limitations which has an article ID of 2.

If you look in the first link you can see that the hardware category also has an ID of 2. So I presumed that there was a (int) typecasting going on.

Router

My attention has now turned to the router.php as I have check those articles are correctly present and were working in the previous version of K2.

In settings the option Use the category ID in the URL was enabled
image
but if you referer back to the first URL the parent category is shown without an ID on the slug.

in the component router this line is responsible for stripping the item ID form the slug

$slug = getItemProps($id, true)->slug;

if this is replaced with the following code it seems to fix routing

$slug = $segments[0];

Further notes

The router slugs between the modes of Use the category ID in the URL are not the same if you ignore the category ID aspect

Cat ID On: https://localhost/platforms/joomla3/kb/articles/25-dsl-broadband/configure-openwrt-on-a-bt-home-hub-5-plusnet-one-router-as-a-secure-wifi-client
CatID Off: https://localhost/platforms/joomla3/kb/articles/kb/hardware/dsl-broadband/configure-openwrt-on-a-bt-home-hub-5-plusnet-one-router-as-a-secure-wifi-client

Will be a new router in K2 for Joomla 4, if not I might need to rework this one?

@shoulders shoulders changed the title Use the category ID in the URL - is not honoured Use the category ID in the URL - is not honoured and breaks routing Jan 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant