Hello,
I use this Fenom construction:
{'pdoResources' | snippet : [
'parents' => $_modx->resource.id,
'tpl' => '@FILE chunks/booksList/pdoTools/book.tpl',
'tvFilters' => '',
'where' => '{"template:IN":[3]}',
'showLog' => '1',
]}
How to use multiple conditions in parameters “tvFilters” and in “where”?
Grts
For the “tvFilters” syntax take a look at the getResources documentation:
//OR
mytv==somevalue||mytv==othervalue
//AND
mytv==somevalue,othertv==othervalue
For the “where” property you can use a JSON array. For example:
//OR
[{"pagetitle:LIKE":"%somevalue%"},{"OR:pagetitle:LIKE":"%othervalue%"}]
//AND
[{"template:IN":[3]},{"parent:IN":[2]}]
1 Like
Hi,
Tnx for your answer.
The function “where” work goed, but tvFilters don’t.
{'pdoResources' | snippet : [
'parents' => $_modx->resource.id,
'tpl' => '@FILE chunks/booksList/pdoTools/book.tpl',
'tvFilters' => 'saleStatus==1',
]}
I need to filter all books by TV saleStatus (single-select Sale==1).
Can i do this via “where”?
Does it work if you add the includeTVs
property?
'includeTVs' => 'saleStatus'
Also, you may have to use ===
instead
'tvFilters' => 'saleStatus===1'
Yes, this should work as well (if includeTVs
is used).
1 Like
A lot of tnx! Both varia working good!