filtermodxmodx-revolutiontemplate-variablesmodx-getresources

ModX getResources &tvFilters not working


I have output from getResourses that I need to sort out by template variable value, but filter is showing resources that have only one value.

For example, this code is showing resources that have only Manhattan TV value. Template variable input type is Tag, output type is default. I have tried to change the input type to Auto-Tag.

[[!getPage@Series?
&element=`getResources`
&parents=`[[*id]]`
&tpl=`New-series-catalog`
&limit=`0`
&debug=`1`
&includeTVs=`1`
&processTVs=`1`
&tvFilters=`door-color==Manhattan`
&tvPrefix=``
]]

Screenshot of TV input options

Output with intentionally broken tpl name

TV value of resource that doesn't output, but should because it has Manhattan tag

I have tried to use only English value names and changing search value to Russian value name but the result is same.


Solution

  • I found the answer.

    To filter by TV that has multiple values you need to add % % to the value.

    For example, my code should look like

    [[!getPage@Series?
    &element=`getResources`
    &parents=`[[*id]]`
    &tpl=`New-series-catalog`
    &limit=`0`
    &debug=`1`
    &includeTVs=`1`
    &processTVs=`1`
    &tvFilters=`door-color==%Manhattan%`
    &tvPrefix=``
    ]]
    

    Instead of

    [[!getPage@Series?
    &element=`getResources`
    &parents=`[[*id]]`
    &tpl=`New-series-catalog`
    &limit=`0`
    &debug=`1`
    &includeTVs=`1`
    &processTVs=`1`
    &tvFilters=`door-color==Manhattan`
    &tvPrefix=``
    ]]
    

    I hope that will help you so you don't waste time trying to figure out whats wrong.