Hi,
I’m having this issue where I’m expecting a certain result and getting something else. I’m try to filter by the following logic
(cond1 AND cond 2) OR (cond3 AND cond2) using the following getResources call...
[[!getResources? &parents=`0` &limit=`100` &tpl=`channel-feed-item` &includeTVs=`1` &includeContent=`1` &tvFilters=`channels==music,content-types==News||cross-channel==music,content-types==News`]]
What it seems to be returning is:
(cond1 AND cond 2) OR cond3 OR cond2
Has anyone had any experience doing this type of getResources call?
Thanks in advance.
I changed the line
$filterGroup = count($tvFilters) > 1 ? $fGroup + 1 : 0;
(line 162) into
$filterGroup = count($tvFilters) > 1 ? $fGroup : 0;
In my case this works. If this isn’t changed, in the block
foreach ($conditions as $cGroup => $c) {
if ($cGroup > 0) {
$criteria->orCondition($c, null, $cGroup);
} else {
$criteria->andCondition($c);
}
}
(starting at line 177) an andCondition is never added when there are more than two conditions delimited by || in the tvFilters Property, and this should lead to a wrong result, if I understand the whole construct correctly. Alternatively, the line
could be changed to
I also posted this in the issue tracker:
https://github.com/opengeek/getResources/issues#issue/9.
Cheers,
Jan
This message has been ROT-13 encrypted twice for higher security.