Y
Y
yuookokk2021-03-02 16:47:09
MODX
yuookokk, 2021-03-02 16:47:09

How to change the sorting in modx, so that it would not be displayed by id, but there ass, desk?

How to change the sorting in modx, so that it would not be displayed by id but ass, desk ?
I correctly understand that sorting is added here?

/** @var pdoFetch $pdo */
$pdo = $modx->getService('pdoFetch');
$list = $pdo->getCollection('modResource', '', [
    'parents'    => $parent,
    'limit'      => 100,
    'includeTVs' => 'tagCategory,tagOption',
    'tvFilters'  => 'tagCategory=='.$modx->resource->id,
]);
if (!$list) {
    return '';
}
$tags = [];
foreach ($list as $v) {
    list($key, $value) = explode('|', $v['tagOption'], 2);
    $tags[] = [
        'key'   => $key,
        'name'  => $value,
        'title' => $v['longtitle'] ?: $v['pagetitle'],
        'uri'   => $v['uri'],
    ];
}
/** @var pdoTools $pdoTools */
$pdoTools = $modx->getService('pdoTools');
return $pdoTools->getChunk($tpl, [
    'tags' => $tags,
]);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sanes, 2021-03-02
@yuookokk

pdoTools is for this.
https://docs.modx.pro/komponentyi/pdotools/snippet...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question