исправление сортировки

This commit is contained in:
2026-01-28 18:30:33 +05:00
parent 2d22279c06
commit 36ae42b0b3

View File

@@ -367,6 +367,9 @@ function commentListShow($tpl_dir)
$sql_sort = "comment_published ASC";
break;
}
// ОПРЕДЕЛЯЕМ НАПРАВЛЕНИЕ ДЛЯ ID (чтобы не было конфликта при одинаковых датах)
$final_direction = (stripos($sql_sort, 'DESC') !== false) ? 'DESC' : 'ASC';
if ($settings['comment_use_page_nav'] == 1)
{
@@ -374,7 +377,7 @@ function commentListShow($tpl_dir)
if ($limit <= 0)
{
$sql = $AVE_DB->Query("SELECT * FROM " . PREFIX . "_module_comment_info WHERE document_id = '" . $document_id . "' " . $where_visibility . " ORDER BY parent_id ASC, " . $sql_sort);
$sql = $AVE_DB->Query("SELECT * FROM " . PREFIX . "_module_comment_info WHERE document_id = '" . $document_id . "' " . $where_visibility . " ORDER BY " . $sql_sort . ", Id " . $final_direction);
$page_nav = '';
}
else
@@ -394,7 +397,7 @@ function commentListShow($tpl_dir)
parent_id != '0'
)
" . $where_visibility . "
ORDER BY comment_published ASC
ORDER BY " . $sql_sort . ", Id " . $final_direction . "
");
if ($num > $limit)
@@ -417,7 +420,7 @@ function commentListShow($tpl_dir)
else
{
// Если навигация отключена
$sql = $AVE_DB->Query("SELECT * FROM " . PREFIX . "_module_comment_info WHERE document_id = '" . $document_id . "' " . $where_visibility . " ORDER BY parent_id ASC, " . $sql_sort);
$sql = $AVE_DB->Query("SELECT * FROM " . PREFIX . "_module_comment_info WHERE document_id = '" . $document_id . "' " . $where_visibility . " ORDER BY " . $sql_sort . ", Id " . $final_direction);
$page_nav = '';
}