Фильтрация записей в Modx revo

607
21 декабря 2016, 04:09

Подскажите как сделать фильтр по tv: proc <select name="proc"><option></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;
READ ALSO
Не удается задать тип SOAP-контейнеру

Не удается задать тип SOAP-контейнеру

Вот так я создаю контейнер:

354
Как изменить внешний вид поля формы?

Как изменить внешний вид поля формы?

Подскажите, как вместо прямоугольного стандартного поля формы получить поле в виде длинного нижнего подчеркивания?

359
Нужно сделать элементы как на фото

Нужно сделать элементы как на фото

Хочу сделать элементы как на фото, а они встают друг за другом :( Знаю что inline нужно использовать, но как именно не понимаю

315