We have a number of Subcategories under a Parent Category, that they have Accented Characters (ά, έ, ή, ώ, á, é, í, ó, ú, ü). For example add subcategories with title άβο and αβα.
We make a Menu Item (Article Category List) of the Parent Category and we ask for the appearence of Subcategories (List Layouts) Category Order: Title Alphabetical
We check result in frontend and we expect that titles come in alphabetical order. In our example, αβα should go before άβο.
We can see that title with Accented Characters come first in the alphabetical order. So, άβο is shown first, before αβα, just because ά has accent and α has not.
Database Type mysql
Database Version 5.7.29-1
Database Collation utf8_general_ci
Database Connection Collation utf8mb4_general_ci
PHP Version 7.2.29
Web Server Apache
WebServer to PHP Interface cgi-fcgi
Joomla! Version Joomla! 3.9.16 Stable [ Amani ] 10-March-2020 15:00 GMT
Joomla! Platform Version Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
I have checked that Article Order in Title Alphabetical with Accented Characters title works fine in Joomla. The problem is only in Category titles alphabetical ordering.
I have checked in Backend, Articles: Categories, to sort by column title and the result is correct! This means that Backend alphabetical order of category titles is correct and the problem appears only in Frontend Menu Item > Article Category List > Category Order: Title Alphabetical
Related issue #26418
I disagree. I have mentioned that the same category titles are sorted correctly if I sort column title in Backend catecories view. But the same categories are sorted wrong in Frontend, if I make a cetegory list menu.
If it is possible to be sorted correctly in Backend, why not in Frontend?
To me, respecting the chosen language of the site to alphabetically sort items in frontend is correct, while backend should rely on the database collation.
To me, respecting the chosen language of the site to alphabetically sort items in frontend is correct, while backend should rely on the database collation.
If I use the same titles with accents as article titles, then the result is correct backend and frontend. So? Anyway I believe that alphabetical order is one and only correct.
I repeat, Joomla has solved this issue for article titles, but not for category titles, because nobody has mentioned this.
Sorry that no one has really responded to yu on this. I suspect that, like me, people saw the accented character part and just moved along. However I did take some time today to review this and it is nothing to do with the accented characters at all. There simply is no option to sort the categories at all
@brianteeman The user here reported an issue with ordering of children categories (or sub-categories) of a category and in this case, we do have support for it. However, the sorting is not locale aware and it is causing this issue. If anyone has this issue, please try to change this line of code to https://github.com/joomla/joomla-cms/blob/4.2-dev/components/com_content/src/Model/CategoryModel.php#L456 to the below code and it should solve the issue:
$this->_children = ArrayHelper::sortObjects($this->_children, 'title', ($orderByPri === 'alpha') ? 1 : (-1), true, Factory::getLanguage()->getLocale());
Labels |
Added:
No Code Attached Yet
bug
Removed: ? |
Related issue #26418