? Success

User tests: Successful: Unsuccessful:

avatar dfritsch
dfritsch
16 Jul 2014

Issue

So I am having an issue with the routing of categories that are child categories, since it seems that the entire category path is added to the url but the id value is not added in the final segment but instead in the second segment (after the view). The parser looks for it in the final segment, so it returns a 404 error, category not found.

Fix should be to change line 162 in the router as follows:

if (!$advanced && count($array))
{
    $array[count($array)-1] = (int) $catid . ':' . $array[count($array)-1];
}

Basically change $array[0] to instead grab the last element. (This also makes more sense since it attaches the id to that actual category.)

If this can be confirmed as a bug, I'll submit the patch.

Testing Instructions

Add a link to a category on the homepage or a non-com_content menu item like the following: index.php?option=com_content&view=category&id=XX. Have SEF Urls on so that the url is routed through JRoute.

Make sure that the category is a second level category or lower.

Resulting url will be like 'component/content/category/16-events/past-events' which will not be routed correctly, because the id is not actually in the final segment. (Note, 16 is the id for the "Past Events" category which is a child to the Events category.)

Tracker

http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_id=8103&tracker_item_id=32086

avatar dfritsch dfritsch - open - 16 Jul 2014
avatar Bakual
Bakual - comment - 17 Jul 2014

Added information from Tracker.

avatar infograf768
infograf768 - comment - 23 Jul 2014

I get wrong result on a multilanguage site:
An article which is reached through this url:

MYDOMAIN/fr/instructions-multilangue/160-activer-le-plugin-système-filtre-de-langue.html

contains this link

<a href="index.php?option=com_content&amp;view=category&amp;id=7" rel="alternate">Lien vers categorie poetes français</a>

The category "poètes français" (id:7) is a child of the category "catégories en français" (id:9)

before patch I get:

MYDOMAIN/fr/instructions-multilangue//fr/instructions-multilangue/7-catégories-en-français/poètes-français.html

The id of the child category is appended to the Mother category but no 404. The category is successfully loaded
(I already have a menu item for that category with a different url: "
MYDOMAIN/fr/poètes-français.html ")

After patch, I get:

MYDOMAIN/fr/instructions-multilangue/catégories-en-français/7-poètes-français.html

and this is a 404

avatar brianteeman brianteeman - change - 21 Aug 2014
The description was changed
Status New Pending
avatar nicksavov nicksavov - change - 21 Aug 2014
Labels Removed: ?
avatar brianteeman brianteeman - change - 2 Sep 2014
Category SEF
avatar Hackwar
Hackwar - comment - 8 Dec 2014

Unfortunately, while I agree with you, that the ID should not be the first part of the category path, we can't change this, since it would break backwards compatibility. It would change existing URLs.

This problem has a deeper root, where someone thought "Oh, it would be cool to not have so many IDs in a category path" and removed all IDs except the first one. That means, that /menu/42-category1/category2 will lead to category2. As well as /menu/42-category1 will lead to category2. Since URLs are modeled after filesystem paths, dropping a segment from the URL should get us one level up in our hierarchy.

As I said, this can not be solved in a backwards compatible way. In my routing efforts, I will provide a solution for this that can be opionally enabled and which introduces IDs for every category segment or can remove all IDs. But until then, we are unfortunately stuck with this.

Now, if the router only looks in the last segment for the category ID, that is a different bug altogether...

avatar Hackwar
Hackwar - comment - 8 Dec 2014

Due to this, I'm closing this PR.

avatar Hackwar Hackwar - change - 8 Dec 2014
Status Pending Closed
avatar jissues-bot
jissues-bot - comment - 8 Dec 2014

Set to "closed" on behalf of @Hackwar by The JTracker Application at issues.joomla.org/joomla-cms/3913

avatar jissues-bot jissues-bot - close - 8 Dec 2014
avatar jissues-bot jissues-bot - change - 8 Dec 2014
Closed_Date 0000-00-00 00:00:00 2014-12-08 10:50:21

Add a Comment

Login with GitHub to post a comment