I have a multi-select product attribute and i am wanting to exclude several values from a collection.
i.e
attribute = filter_theme
possible values = A, B, C, D, E, F, G, H
If i use nin
like so:
$collection->addAttributeToFilter('filter_theme', array('nin' => $exclude));
It will only work if the products only have a single selection on filter_theme
i.e value A
If they have more than one it won't work i.e values A & B
. (I know this is also the case when using in
to find rather than exclude)
Again i know that i can use finset
to find any products with $exclude, whether it has 1 or all options selected:
$collection->addAttributeToFilter('filter_theme', array('finset' => $exclude));
This will work on both value A
only and value A & B & C
being selected.
Is there a way of doing the opposite of finset
to exclude rather than include so that it works no matter how many values are selected for my attribute?