Условие вывода MIGX через getImageList для checkbox

Всем добрый день!
Буду очень благодарен сообществу.
Подскажите каким образом задать условие Where что бы оно работала по наличию ID ресурса в дополнительном поле MIGX
[[getImageList?
	&docid=`100`
	&tvname=`price_montaj`
	&tpl=`price_montaj_tpl`
	&where=`{"priceserv:LIKE":"%#92#%"}`
	&limit=`999`
]]
Поле priceserv в MIGX может содержать несколько значений.
Пример с

Сейчас код выше работает только того когда поле priceserv содержит только одно значение.

priceserv — типа (checkbox) в MIGX отмечены ресурсы и их может быть несколько.
taxsin
16 февраля 2020, 14:37
modx.pro
1 207
0

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

Yurij Finiv
16 февраля 2020, 14:42
0
А заменить «LIKE» на «IN» не подходит? Не использую стандартные решения MIGX.

docs.modx.com/current/en/extending-modx/xpdo/class-reference/xpdoquery/xpdoquery.where
    taxsin
    16 февраля 2020, 14:47
    0
    &where=`{«priceserv:IN»:"%#92#%"}` не работает почему-то(
    Ничего не выводит
      Yurij Finiv
      16 февраля 2020, 14:50
      0
      &where=`{«priceserv:IN»:["#92#"]}`, а так IN принимает массив и не должно быть %
        taxsin
        16 февраля 2020, 14:58
        0
        В таком случае выводит только элемент из списка, который содержит только одно значение — 92.
          Yurij Finiv
          16 февраля 2020, 15:17
          0
          Если такое не работает т=&where=`{«priceserv:IN»:["#92#","#13#"]}, то только &where=`{«priceserv:LIKE»:"%#92#%",«AND:priceserv:LIKE»:"%#13#%"}`

          Или AND заменить на OR зависит от случая
            taxsin
            16 февраля 2020, 17:13
            0
            Мне не очень подходит такое решение. Так как #92#, #13# — это идентификаторы ресурса и я хочу выводить на странице определенные строки из таблицы MIGX значение поля priceserv (типа checkbox) соответствует ID ресурса.
    taxsin
    16 февраля 2020, 18:18
    0
    Не понимаю, как получается, что MIGX нет возможности фильтрации по полю Checkbox, если выбрано несколько значений. Или я что-то не понимаю
      taxsin
      16 февраля 2020, 18:50
      0
      Решил вопрос не документированным условием contains
      &where=`{"priceserv:contains":"[[*id]]"}
        Denis
        15 июля 2022, 12:01
        0
        Фильтрация происходит здесь:
        core/components/migx/model/migx/migx.class.php
        function filterItems($where, $items) {
        
                $tempitems = array();
                foreach ($items as $item) {
                    $include = true;
                    foreach ($where as $key => $operand) {
                        $key = explode(':', $key);
                        $field = $key[0];
                        $then = $include;
                        $else = false;
                        $subject = $item[$field];
        
                        $operator = isset($key[1]) ? $key[1] : '=';
                        $params = isset($key[2]) ? $key[2] : '';
                        $operator = strtolower($operator);
                        switch ($operator) {
                            case '!=':
                            case 'neq':
                            case 'not':
                            case 'isnot':
                            case 'isnt':
                            case 'unequal':
                            case 'notequal':
                                $output = (($subject != $operand) ? $then : (isset($else) ? $else : ''));
                                break;
                            case '<':
                            case 'lt':
                            case 'less':
                            case 'lessthan':
                                $output = (($subject < $operand) ? $then : (isset($else) ? $else : ''));
                                break;
                            case '>':
                            case 'gt':
                            case 'greater':
                            case 'greaterthan':
                                $output = (($subject > $operand) ? $then : (isset($else) ? $else : ''));
                                break;
                            case '<=':
                            case 'lte':
                            case 'lessthanequals':
                            case 'lessthanorequalto':
                                $output = (($subject <= $operand) ? $then : (isset($else) ? $else : ''));
                                break;
                            case '>=':
                            case 'gte':
                            case 'greaterthanequals':
                            case 'greaterthanequalto':
                                $output = (($subject >= $operand) ? $then : (isset($else) ? $else : ''));
                                break;
                            case 'isempty':
                            case 'empty':
                                $output = empty($subject) ? $then : (isset($else) ? $else : '');
                                break;
                            case '!empty':
                            case 'notempty':
                            case 'isnotempty':
                                $output = !empty($subject) && $subject != '' ? $then : (isset($else) ? $else : '');
                                break;
                            case 'isnull':
                            case 'null':
                                $output = $subject == null || strtolower($subject) == 'null' ? $then : (isset($else) ? $else : '');
                                break;
                            case 'inarray':
                            case 'in_array':
                            case 'ia':
                            case 'in':
                                $operand = is_array($operand) ? $operand : explode(',', $operand);
                                $output = in_array($subject, $operand) ? $then : (isset($else) ? $else : '');
                                break;
                            case 'find':
                            case 'find_in_set':
                                $subject = is_array($subject) ? $subject : explode(',', $subject);
                                $output = in_array($operand, $subject) ? $then : (isset($else) ? $else : '');
                                break;
                            case 'find_pd':
                            case 'find_in_pipesdelimited_set':
                                $subject = explode('||', $subject);
                                $output = in_array($operand, $subject) ? $then : (isset($else) ? $else : '');
                                break;
                            case 'contains':
                                $output = strpos($subject, $operand) !== false ? $then : (isset($else) ? $else : '');
                                break;
                            case 'snippet':
                                $result = $this->modx->runSnippet($params, array('subject' => $subject, 'operand' => $operand));
                                $output = !empty($result) ? $then : (isset($else) ? $else : '');
                                break;
                            case '==':
                            case '=':
                            case 'eq':
                            case 'is':
                            case 'equal':
                            case 'equals':
                            case 'equalto':
                            default:
                                $output = (($subject == $operand) ? $then : (isset($else) ? $else : ''));
                                break;
                        }
        
                        $include = $output ? $output : false;
        
                    }
                    if ($include) {
                        $tempitems[] = $item;
                    }
        
                }
                return $tempitems;
            }
          Авторизуйтесь или зарегистрируйтесь, чтобы оставлять комментарии.
          9