Help with Tagger / TaggerGetResourcesWhere

Hey all,

I’m struggling with what I thought would be an easy one :slight_smile:
How can I select ALL resources on site that have at least ONE tag from the groups provided?

[[!pdoResources?
    &parents=`0`
    &limit=`0`
    &tpl=`test-tpl`
    &where=`[[!TaggerGetResourcesWhere?
        &groups=`1,2,3`
        &tags=``
    ]]`
]]

The above returns ALL resources - tagged or not.

Any suggestions?

Thanks!

It seems that you need to write your own sql-subquery to get the desired result. Something like:

[[!getResources?
    &parents=`0`
    &limit=`0`
    &tpl=`test-tpl`
    &where=`["EXISTS (SELECT 1 FROM `modx_tagger_tag_resources` r INNER JOIN `modx_tagger_tags` t INNER JOIN `modx_tagger_groups` tg WHERE r.tag = t.id AND t.group = tg.id AND tg.id IN (1,2,3) AND r.resource = modResource.id)"]`
]]
1 Like

Thanks @halftrainedharry - I would have NEVER sorted that one out like that. Much appreciated!