jber
1
Modx 2.7.3
getResources 1…6.1
Tagger 1.11.0
Hello,
I am using the getResources snippet with TaggerGetResourcesWhere it works fine.
[[!getResources? &where=`[[!TaggerGetResourcesWhere? &tags=`aphids,flowers` &groups=`1,2` &matchAll=`1`]]` &parent=`5` &tpl=`products` &limit=`0` &sortdir=`ASC` &sortby=`menutitle` &processTVs=`1` &includeTVs=`1`]]
I’m trying to use modx => runsnippet to do the same thing, but it doesn’t work. I think I am making mistakes in the formulation of the runsnippet.
Could someone tell me where my mistakes are?
$result = $modx->runSnippet('getResources', array('where' => $modx->runSnippet('TaggerGetResourcesWhere', array('tags' => 'aphids,flowers', 'groups' => '1,2', 'matchAll' => 1,)), 'parent' => 5,'tpl' => 'products', 'limit' => '0', 'processTVs' => '1', 'sortby' => 'menutitle', 'includeTVs' => '1'));
return $result
Thanks for your help.
The mistake could be that getResources has no property parent
! The property is called parents
(with an s
at the end).
bruno17
3
maybe 'matchAll' => 1,
should be 'matchAll' => '1'
jber
4
First of all thank you for your answers.
I found my problem, especially do not laugh. You surely know the expression “can’t see the forest for the trees”.
I was so sure that the problem was in the formulation of my runSnippet, that I had forgotten the “return $result”.
I had this as a code:
if (condition) {
$result = $ result = $ modx-> runSnippet (‘getResources’, array (‘where’ => $ modx-> runSnippet (‘TaggerGetResourcesWhere’ …
return $result; =====> was misssing
} else {
$result = $ modx-> runSnippet …
return $result;
}
In these difficult times, take good care of the beings you love and I wish you happy holidays.
Thanks again
1 Like