Answer the question
In order to leave comments, you need to log in
How to sort modx revo goods correctly?
Hello.
I'm trying to make the output of goods with pagination and the ability to sort in Modx Revo.
If you use the "pdoPage" snippet to display products, then there will be pagination, but sorting by price does not work correctly (sorting works as if by string values, apparently the parameter - sortbyTVType=integer does not work in this snippet).
If you use the "pdoResources" snippet, sorting works according to the price of the norms, but there is no pagination.
Tell me how to be? What to use to get the output of goods, with pagination and correct sorting by price.
$limit = $scriptProperties['limit'];
$where = $scriptProperties['where'];
$tpl = $scriptProperties['tpl'];
$includeTVs = $scriptProperties['includeTVs'];
$depth = $scriptProperties['depth'];
$parents = $scriptProperties['parents'];
$resources = $scriptProperties['resources'];
$paginate = $scriptProperties['paginate'];
$sortby = '';
$sortdir = '';
$arParams = array(
'tpl'=> $tpl,
'includeTVs'=> $includeTVs,
'limit' => $limit,
'depth' => $depth,
);
if($_REQUEST['ditto_sortDir']){
$arParams['sortdir'] = $_REQUEST['ditto_sortDir'];
}
if($_REQUEST['ditto_sortBy']){
$arParams['sortby'] = $_REQUEST['ditto_sortBy'];
}
if($where){
$arParams['where'] = $where;
}
if(isset($parents)){
$arParams['parents'] = $parents;
}
if($resources){
$arParams['resources'] = $resources;
}
$arParams['sortbyTVType'] = 'integer';
if($paginate){
$arParams['pageLimit']='6';
$output = $modx->runSnippet('pdoPage', $arParams);
}else{
$output = $modx->runSnippet('pdoResources', $arParams);
}
if(!$output){$output = 'Результатов нет';};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question