[[+content_image]]
A
A
Alexander Yelagin2016-05-06 23:03:21
MODX
Alexander Yelagin, 2016-05-06 23:03:21

How to filter resources via tv-parameter in getResources?

Hello.
It is necessary to filter resources by specifying the value of the TV parameter in the request condition. But the value of the tv-parameter can be a comma-separated list.

[[pdoResources?
    &tpl=`table-analogi`
    &parents=`[[*parent]]`
    &includeTVs=`1`
    &processTVs=`1`    
     &where=`{"main_goods:IN" : [[*analog_goods]]}`
    &includeTVs=`brand,main_goods,price,title,analog_goods`
    &showLog=`1`
    &debug=`1`]]

0.0000110: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `tv.title` 0.0000842 :
Replaced TV conditions
0.0058479: Processed additional conditions . Tell me how to correctly compose the "where" condition so that you can apply the condition by the TV parameter

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
S
Sergey, 2016-05-09
@Derzaiii

Try this option:

&where=`["1 = 1 AND FIND_IN_SET('[[*main_goods]]', replace(analog_goods, '||', ','))"]`

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question