Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

JoomlaTune Support Forum    JComments component    Bug-reports    Topic: ORDER BY section/category lists on backend
Pages: [1]   Go Down
  Print  
Author Topic: ORDER BY section/category lists on backend  (Read 930 times)
0 Members and 1 Guest are viewing this topic.
drewgg
Newbie
*

Karma: 0
Offline Offline

Posts: 11


« on: February 09, 2011, 02:29:32 »

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,  Grin
Logged
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #1 on: February 13, 2011, 18:09:57 »

Thank youm you are fully right. I will fix it in next JComments release! Thank you again for sharing the solution!
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
Pages: [1]   Go Up
  Print  
JoomlaTune Support Forum    JComments component    Bug-reports    Topic: ORDER BY section/category lists on backend
 
Jump to: