Tagger
Tagger copied to clipboard
matchAllGroups option
I suggest an additional TaggerGetResourcesWhere option that would match all groups. This would allow it to be better used for catalog sorting options when sorting separately by types, manufacturers or whatever product options. The where clause would be something like:
WHERE (Type = A OR Type = B) AND (Manufacturer = C OR Manufacturer = D) AND (Color = Red OR Color = White)
Not sure why is better to match all? For the WHERE you mentioned you can construct URL /type/A/B/manufacturer/C/D/color/Red/White
What we want it to do is to narrow the results when selecting different groups but expand the results when selecting multiple tags within a single group. We are trying to use Tagger's TaggergetResourcesWhere to provide no-refresh product filtering using pdoResources, Tagger and Ajax. Say a user wants to find red and green items only from Acme, there is no way I can find to do it with the current methods.
With matchAll on: WHERE Type = A AND Type = B AND Manufacturer = C AND Manufacturer = D AND Color = Red AND Color = White
With matchAll off: WHERE Type = A OR Type = B OR Manufacturer = C OR Manufacturer = D OR Color = Red OR Color = White
Here is our site that may better demonstrate. http://www.prevailingarms.com/rifles/ Checking a checkbox inside each box should add to the list but not add any items disqualified by what is checked in another box.
Are you talking about this param https://github.com/modxcms/Tagger/blob/master/core/components/tagger/elements/snippets/taggergetrelatedwhere.snippet.php#L26 ?
Same parameter name but in this snippet: https://github.com/modxcms/Tagger/blob/master/core/components/tagger/elements/snippets/taggergetresourceswhere.snippet.php#L16
here you go: https://github.com/modxcms/Tagger/blob/master/core/components/tagger/elements/snippets/taggergetresourceswhere.snippet.php#L16
To achieve the results we seek, we need OR within each group of tags and AND between the groups. The current matchAll doesn't take groups into account.
Yes, i think this would be good as well.
In my example, i have a catalogue where i put all products. Then they are able to add the following groups: States, Colors, Product Category, Collection
Their product could exist in one or many states. In one or many colors. In one or many Categories. In one or many collections.
-
We would like the end user to first select a state they are interested in. So they chose California.
-
Then the user would like to see products in California within the summer collection.
-
The user would then like to see t-shirts within the summer collection in California.
-
They also wanna see pants. So they select pants.
But this is where I can't seem to get tagger to work out of the box since to be able to show both pants and t-shirts within the summer collection in California the pants and t-shirt products must both be tagged as t-shirts and pants.
This is by using matchAll. If we don't use matchAll, then it would show all pants and t-shirts within all collections and all states. Which is not what we want.
So we currently sorted it by our own xpdo queries. But if it could be solved with some improvements to the TaggerGetResourcesWhere snippet it would be great.
If this can be achieved then i am sorry, because i must have missed it.
I'm going to add a request for this myself. I have exactly this same problem right now. Are there any solutions since.... 2016?