- Posts: 11
COMMUNITY FORUM
Tag sorting
- Tomaso Burkaso
- Topic Author
- Offline
- New Member
Less
More
14 years 10 months ago #77529
by Tomaso Burkaso
Tag sorting was created by Tomaso Burkaso
Hello
When adding article tags are ordered by time. How to make it alphabetically?
Thanks in....
Tomasz
When adding article tags are ordered by time. How to make it alphabetically?
Thanks in....
Tomasz
Please Log in or Create an account to join the conversation.
- John Wicks
- Offline
- New Member
Less
More
- Posts: 15
14 years 10 months ago #77530
by John Wicks
Replied by John Wicks on topic Tag sorting
Suggest changing the com_k2/models/item.php file around line 690 for v2.2.
Add an Order By clause to the SQL in the getItemTags function...
$query="SELECT * 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`";
Add an Order By clause to the SQL in the getItemTags function...
$query="SELECT * 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`";
Please Log in or Create an account to join the conversation.
- John Wicks
- Offline
- New Member
Less
More
- Posts: 15
14 years 10 months ago #77531
by John Wicks
Replied by John Wicks on topic Tag sorting
Also...
John Wicks said:Suggest changing the com_k2/models/item.php file around line 690 for v2.2.Add an Order By clause to the SQL in the getItemTags function...$query="SELECT * 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`";
In the models/index.php change the following code...
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
John Wicks said:Suggest changing the com_k2/models/item.php file around line 690 for v2.2.Add an Order By clause to the SQL in the getItemTags function...$query="SELECT * 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`";
In the models/index.php change the following code...
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.
- Tomaso Burkaso
- Topic Author
- Offline
- New Member
Less
More
- Posts: 11
14 years 10 months ago #77532
by Tomaso Burkaso
Replied by Tomaso Burkaso on topic Tag sorting
Thanks to all.
Tomasz
Tomasz
Please Log in or Create an account to join the conversation.