[[!getPage@articlePaging?
&element=`migxLoopCollection`
&packageName=`redaspackage`
&classname=`redasPackage`
&tpl=`articleResults`
&limit=`20`
&where=`{"title:LIKE":"[[!GetSearchTerm]]",
"OR:keywords:LIKE":"[[!GetSearchTerm]]",
"resource_id:LIKE":"[[!GetSource]]"}`
&sortConfig=`[{"sortby":"createdon","sortdir":"DESC"}]`]]
This question has been answered by Bruno17. See the first response.
$term = $modx->getOption('term',$_REQUEST,'');
$source = $modx->getOption('source',$_REQUEST,'');
$wheres = array();
if (!empty($source)){
$wheres[] = array('resource_id'=>$source);
}
if (!empty($term)){
$wheres[] = array('title:LIKE'=>'%'.$term.'%','OR:keywords:LIKE'=>'%'.$term.'%');
}
return $modx->toJson($wheres);[[!getPage@articlePaging?
&element=`migxLoopCollection`
&packageName=`redaspackage`
&classname=`redasPackage`
&tpl=`articleResults`
&limit=`20`
&where=`[[!preparewhere]]`
&sortConfig=`[{"sortby":"createdon","sortdir":"DESC"}]`]]