Kayako logo
Developers & Code Interested in customizing your Kayako products? Discuss modifications and develop your own mods with the community.

Kayako develops robust helpdesk software, live chat and real-time visitor monitoring software.
Kayako is trusted by more than 30,000 organizations, including a number of Fortune 500 companies and government institutions.
Reply
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  (#1) Old
Matthew Offline
Member
 
Matthew's Avatar
 
Posts: 259
Join Date: Oct 2007
Location: Jakarta, Indonesia
Sort the KB Javascript menus alphabetically - 01-12-2008, 08:13 AM

In the Staff CP, I want to alphabetize the articles in the Knowledgebase 'Quick Jump' and 'Quick Insert' javascript menus. (I've already got the categories and sub-categories alphabetized.)

I believe the key is in function buildKBArticleData() from functions_knowledgebase.php.

First, there is this line, which does not seem to affect the sort of the menu:

PHP Code:
    $dbCore->query("SELECT * FROM `"TABLE_PREFIX ."kbarticles` AS kbarticles LEFT JOIN `"TABLE_PREFIX ."kbarticledata` AS kbarticledata ON (kbarticles.kbarticleid = kbarticledata.kbarticleid) ORDER BY kbarticles.kbarticleid ASC;"); 
Then there is this one, which I suspect is where the issue lies; however, I don't understand how to contruct the query that would create the correct sort order:
PHP Code:
    $dbCore->query("SELECT * FROM `"TABLE_PREFIX ."kbarticlelinks` ORDER BY `kbarticlelinkid` ASC;"2); 
Anyone willing to help? Surely others would like to see the KB list in alphabetical order...


Matthew Arciniega
Free: Ticket List & Search | Dept. Display Names
Free: Outlook/HTML Tickets| Staff Parser Log
Tutorials: SLA System
| Template Groups
KSS v3.20.02 | PHP: 5.2.6 | MySQL: 5.0.58 | CentOS 4
   
Reply With Quote
  (#2) Old
Jamie Edwards Offline
Operations Manager
 
Jamie Edwards's Avatar
 
Posts: 6,270
Join Date: Jan 2006
Location: England, UK
01-12-2008, 10:11 AM

I have not tested this, but I have modified the query so that it joins the two tables kbarticlelinks and kbarticles together, ordering the two by the respective article subject (ascending - a to z). The SQL works, I am not sure if it will in place of the existing code.

SQL:
Code:
SELECT * FROM swkbarticlelinks, swkbarticles WHERE swkbarticlelinks.kbarticleid = swkbarticles.kbarticleid ORDER BY swkbarticles.subject ASC;
PHP:
PHP Code:
$dbCore->query("SELECT * FROM `"TABLE_PREFIX ."kbarticlelinks`, `"TABLE_PREFIX ."kbarticles` WHERE `"TABLE_PREFIX ."kbarticlelinks.kbarticleid` = `"TABLE_PREFIX ."kbarticles.kbarticleid` ORDER BY `"TABLE_PREFIX ."kbarticles.subject` ASC;"2); 


Jamie Edwards (jamie.edwards ]at[ kayako.com)
----------------------------------------------------------------
---
   
Reply With Quote
  (#3) Old
Matthew Offline
Member
 
Matthew's Avatar
 
Posts: 259
Join Date: Oct 2007
Location: Jakarta, Indonesia
01-12-2008, 01:01 PM

Quote:
Originally Posted by Jamie Edwards View Post
I have not tested this, but I have modified the query so that it joins the two tables kbarticlelinks and kbarticles together, ordering the two by the respective article subject (ascending - a to z). The SQL works, I am not sure if it will in place of the existing code.
Great Jamie! That was just enough to get me started. This is actually the code that does the trick...
PHP Code:
    $dbCore->query("SELECT * FROM `"TABLE_PREFIX ."kbarticlelinks`, `"TABLE_PREFIX ."kbarticles` WHERE ("TABLE_PREFIX ."kbarticlelinks.kbarticleid = "TABLE_PREFIX ."kbarticles.kbarticleid) ORDER BY "TABLE_PREFIX ."kbarticles.subject ASC;"2); 


Matthew Arciniega
Free: Ticket List & Search | Dept. Display Names
Free: Outlook/HTML Tickets| Staff Parser Log
Tutorials: SLA System
| Template Groups
KSS v3.20.02 | PHP: 5.2.6 | MySQL: 5.0.58 | CentOS 4
   
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sort Sort Sort NC Software SupportSuite, eSupport and LiveResponse 5 15-12-2008 02:16 PM
Sort ascending (Alphabetically) department lists joshuah Developers & Code 1 15-08-2008 03:54 AM
I need to sort my Dropdown Menus alphabetically rudier SupportSuite, eSupport and LiveResponse 8 10-08-2007 08:55 AM
Admincp -> Staff -> Add -> Sort staff groups alphabetically craigbrass Will Implement (V4) 0 10-08-2007 08:54 AM



Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71