Keyword

K2 v2.2x Item Display Tags list is ordered by ID not alphabetically

  • John Wicks
  • John Wicks's Avatar Topic Author
  • Offline
  • New Member
More
14 years 3 months ago #77585 by John Wicks
Hello All,

 

In K2 Item display the tags list is displayed by id rather than Alphabetically. Not sure if this is a "bug" but the SQL code in models/item.php getItemTags, line 694, should be:

 

$query="SELECT `id`, `name` FROM #__k2_tags as tags WHERE tags.published=1 AND tags.id IN (SELECT `tagID` FROM #__k2_tags_xref WHERE `itemID`={$itemID}) order by `name`";

 

Also in the administration area change the following functions in models/item.php...

 

    function getAvailableTags($itemID = NULL) {

        $db = &JFactory::getDBO();        $query = "SELECT * FROM #__k2_tags as tags";        if (!is_null($itemID))            $query .= " WHERE tags.id NOT IN (SELECT tagID FROM #__k2_tags_xref WHERE itemID={$itemID})";  $query .= " ORDER BY `name`";        $db->setQuery($query);        $rows = $db->loadObjectList();        return $rows;    }

    function getCurrentTags($itemID) {

        $db = &JFactory::getDBO();        $query = "SELECT * FROM #__k2_tags as tags WHERE tags.id IN (SELECT tagID FROM #__k2_tags_xref WHERE itemID={$itemID}) ORDER BY `name`";        $db->setQuery($query);        $rows = $db->loadObjectList();        return $rows;    }

 

Jw

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum