diff --git a/class/comment.php b/class/comment.php index 0deb93b..2f6a4a4 100644 --- a/class/comment.php +++ b/class/comment.php @@ -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 = ''; }