Jump to content
Sign in to follow this  
kphp

[Фича] Сортировать по дате

Recommended Posts

1 заходим в templates\Default\search открыть файл
ишем

<div class="html_checkbox" id="online" onClick="myhtml.checkbox(this.id); gSearch.go();">сейчас на сайте</div>

после ставим

<div class="html_checkbox" id="sortbydate" onClick="myhtml.checkbox(this.id); gSearch.go();" style="margin-top:9px;margin-bottom:12px;">сортировать по дате</div>

тамже находим myhtml.checked(['{checked-online}', '{checked-user-photo} вставляем сюда ']);

вот эта

', '{checked-sortbydate}

2 заходим в templates\Default\js открыть там файл profile.js

ишем

user_photo = $('#user_photo').val();

ниже ставим

sortbydate = $('#sortbydate').val();

тамже ишем

if(user_photo != 0) all_queryeis_user_photo = '&user_photo='+user_photo;
                                else all_queryeis_user_photo = '';
                               
ниже ставим

if(sortbydate != 0) all_queryeis_sortbydate = '&sortbydate='+sortbydate;
                                else all_queryeis_sortbydate = '';
                               
ишем

res_sort_query = all_queryeis_sex+all_queryeis_day+all_queryeis_month+all_queryeis_year+all_queryeis_country+all_queryeis_city+all_queryeis_online+all_queryeis_user_photo+all_queryeis_sp+all_queryeis_mesto+all_queryeis_dolj+all_queryeis_chast+all_queryeis_countrysl+all_queryeis_nacalosl;

вканце строчки находим

+all_queryeis_nacalosl

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

+all_queryeis_sortbydate

3 заходим в system\modules открыть там файл search.php

ишем

$user_photo = intval($_GET['user_photo']);

ниже ставим

$sortbydate = intval($_GET['sortbydate']);

ишем

        if($type == 1){ //Если критерий поиск "по людям"
                $sql_query = "SELECT user_id, user_search_pref, user_photo, user_birthday, user_country_city_name, user_last_visit, user_rai, user_metro, user_ulica, user_nazvanie, user_shkola, user_klass, user_spec,  user_vuz, user_fac, user_form, user_statusvi, user_dolj, user_chast, user_zvanie, user_pred, user_logged_mobile FROM `".PREFIX."_users` {$where_sql_gen} {$sql_sort} ORDER by `user_rate` DESC LIMIT {$limit_page}, {$gcount}";
                $sql_count = "SELECT COUNT(*) AS cnt FROM `".PREFIX."_users` {$where_sql_gen} {$sql_sort}";
       
заменяем на

        if($type == 1){ //Если критерий поиск "по людям"
        if ($sortbydate) {
                    $sql_query = "SELECT SQL_CALC_FOUND_ROWS user_id, user_real, user_paid, user_search_pref, user_photo, user_birthday, user_country_city_name, user_last_visit, vkava1 FROM `".PREFIX."_users` WHERE user_search_pref LIKE '%{$query}%' {$sql_sort} ORDER by `user_id` LIMIT {$limit_page}, {$gcount}";
                    $sql_count = "SELECT COUNT(*) AS cnt FROM `".PREFIX."_users` WHERE user_search_pref LIKE '%{$query}%' {$sql_sort}";
        } else {
                    $sql_query = "SELECT SQL_CALC_FOUND_ROWS user_id, user_real, user_paid, user_search_pref, user_photo, user_birthday, user_country_city_name, user_last_visit, vkava1 FROM `".PREFIX."_users` WHERE user_search_pref LIKE '%{$query}%' {$sql_sort} ORDER by `user_rate` DESC LIMIT {$limit_page}, {$gcount}";
                    $sql_count = "SELECT COUNT(*) AS cnt FROM `".PREFIX."_users` WHERE user_search_pref LIKE '%{$query}%' {$sql_sort}";
        };
               
ишем

if($online) $tpl->set('{checked-online}', 'online');
else $tpl->set('{checked-online}', '0');

ниже ставим

if($sortbydate) $tpl->set('{checked-sortbydate}', 'sortbydate');
        else $tpl->set('{checked-sortbydate}', '0');

автор неизвестен

210435noj7nv7oyrinmnmy.png

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×