Browser: n/a
Joomla Version: 1.5.21
Jcomments Version: 2.2.0.2
In Components > Jcomments > Settings > Categories the Section/Category list wasn't showing in alphabetical order like it should. The SQL call that gets the rows for that list is in /administrator/components/com_jcomments/admin.jcomments.php line 997:
$query = "SELECT c.id AS `value`, CONCAT_WS( ' / ', s.title, c.title) AS `text`"
. "\n FROM #__sections AS s"
. "\n INNER JOIN #__categories AS c ON c.section = s.id"
. "\n ORDER BY s.name,c.name"
;
The problem is that on all my Joomla installs the `name` column of #__sections and #__categories is empty for every element. I'm guessing it's a legacy column from J! 1.0? I check a bunch of my Joomla installs and they all have empty `name` columns. Anyway my fix was to add the `title` columns as a 3rd and 4th ORDER BY parameter:
$query = "SELECT c.id AS `value`, CONCAT_WS( ' / ', s.title, c.title) AS `text`"
. "\n FROM #__sections AS s"
. "\n INNER JOIN #__categories AS c ON c.section = s.id"
. "\n ORDER BY s.name,c.name,s.title,c.title"
;
There is another query above this one that suffers from the same issue...
starting line 984:
$query = "SELECT c.id AS `value`, CONCAT_WS( ' / ', s.title, c.title) AS `text`"
. "\n FROM #__sections AS s"
. "\n INNER JOIN #__categories AS c ON c.section = s.id"
. "\n WHERE c.id IN ( " . $config->get('enable_categories') . " )"
. "\n ORDER BY s.name,c.name"
;
becomes:
$query = "SELECT c.id AS `value`, CONCAT_WS( ' / ', s.title, c.title) AS `text`"
. "\n FROM #__sections AS s"
. "\n INNER JOIN #__categories AS c ON c.section = s.id"
. "\n WHERE c.id IN ( " . $config->get('enable_categories') . " )"
. "\n ORDER BY s.name,c.name,s.title,c.title"
;
Hope this helps the project or anyone else who is having the same issue,
