Фильтр по по одиночному списку

Подскажите как сделать фильтр по
`tv: proc` `<select name="proc"><option>15%</option><option>20%</option></select>` по `input`
фильтрует, если вводим а по селект не могу понять как
форма поиска

<form class="form-s ajax-form">
    
    		  <!-- Sort Fields -->
              <input type="hidden" name="sortby" value="pagetitle">
              <input type="hidden" name="sortdir" value="asc">
              <!-- Sort End -->
    
    		  <div class="col-md-6 pad-5">
    			<input type="text" class="s-in" name="city" id="search-input proc" placeholder="Поиск...">
    		  </div>
    		  <div class="col-md-3 pad-5">
    			<select  class="s-proc"  name="proc">
    			  <option>32 </option>
    			  <option>2</option>
    			  <option>3</option>
    			  <option>4</option>
    			  <option>5</option>
    			</select>
    		  </div>
    
    		</form>
вывод ресурсов фильтрации
<div class="row ajax-container" style="padding-left:15px;padding-right:15px;">
          [[!CatalogFilter?
          &tpl=`cat_list`
          &limit=`5`
          &parents=`[[*id]]`
          &fields = `city,imgF,mts,velc,lif,site,work,proc`
          ]]
    </div>


и сниппет

<?php
    //Filter Fields Settings
    $filter = array();
    //Radio, Select & Text Fields Type
    if($_GET['proc']) {
        $filter[] = 'proc='.$_GET['proc'];
    }
    if($_GET['operation']) {
        $filter[] = 'operation='.$_GET['operation'];
    }
    //End Settings
    //Sort
    if($_GET['sortby']) {
        $sortby = $_GET['sortby'];
    } else {
        $sortby = 'pagetitle';
    }
    if($_GET['sortdir']) {
        $sortdir = $_GET['sortdir'];
    } else {
        $sortdir = 'asc';
    }
    //End Sort
    
    //Offset
    $offset = 0;
    if($_GET['offset']){
        $offset = $_GET['offset'];
    }
    
    if($filter) {
        $where = $modx->toJSON(array($filter));
    } else {
        $where = '';
    }
    
    $params_count = array(
        'parents' => $parents,
        'limit' => 0,
        'tpl' => '@INLINE ,',
        'select' => 'id',
        'includeTVs' => $fields,
        'showHidden' => '1',
        'where' => $where
    );
    
    $count = $modx->runSnippet('pdoResources',$params_count);
    $count = count(explode(',',$count))-1;
    $modx->setPlaceholder('count',$count);
    
    $params = array(
        'parents' => $parents,
        'limit' => $limit,
        'offset' => $offset,
        'tpl' => $tpl,
        'select' => 'id,pagetitle,introtext,content',
        'includeTVs' => $fields,
        'showHidden' => '1',
        'sortby' => $sortby,
        'sortdir' => $sortdir,
        'where' => $where
    );
    
    $more = $count - $offset - $limit;
    $lim = $more > $limit ? $limit : $more;
    
    $button = '';
    if($more > 0){
        $button = '<div class="ajax-filter-count" data-count="'.$count.'"><a href="#" class="ajax-more">Загрузить еще '.$lim.' из '.$more.'</a></div>';
    }
    
    return $modx->runSnippet('pdoResources',$params).$button;
Максим
24 декабря 2016, 22:15
modx.pro
1 338
0

Комментарии: 0

Авторизуйтесь или зарегистрируйтесь, чтобы оставлять комментарии.
0