Description
When trying to use a negative condition on a promotional rule, it will not match any products which have no value for that attribute, even though one would expect it to. As a result promotions do not apply to products that the people creating the conditions would expect them to apply to.
The same happens to category conditions - see issue #32734 and I suspect it is the same query logic behind the scenes
There is a workaround for "dropdown" type attributes in that the "undefined" option exists and one can therefore combine "not ..." or "undefined" to get the result we want. There is no such option for multiselect or categories.
Preconditions (*)
- This was tested on 2.4.2
- products with a dropdown or multiselect attribute set to be usable for promotion rules - I have used bags in the demo data and the attribute "activities".
- modify the "overnight duffle" to only have activity "overnight" (useful if you want to test "one of" and "not one of")
- check that joust duffle back has no activity set (in my vanilla install, it was blank)
Steps to reproduce (*)
- Validation: create a catalog product rule for products with the condition "contains overnight" to check the data is behaving correctly. Apply, reindex, clear caches, check it is behaves as expected and all 4 products have the special price
- Change the rule to "does not contain overnight". Apply, reindex, clear caches, reload page
Expected result (*)
- You would expect to see the "reverse" of the previous selection, all products have special price except for the 4 with the attribute option set. Including the one where the attribute isn't set.
Actual result (*)
- The rule has not applied to the product where the attribute isn't set.
The same thing happens with "is not one of" - it also happens to similar conditions on CATEGORIES and it also happens on the "is not" for a DROPDOWN attribute.
Obviously this example uses the demo content and it doesn't seem as if one would want to create such a condition, but there are many cases where one might want to exclude products based on an attribute. In my case the "the promotion isn't applying to products we'd expect it to apply to" came up several times before we figured it out.
It is very possible that this is the only reasonably efficient way that these conditions can work, but if it is the case a condition "attribute has no set value" and "no category set" should exist to allow for working around it.
For the dropdown attribute this exists as the condition "is undefined" - there is no equivalent for a multiselect as there is no "undefined" option.
If the logic for these criteria can't change, then an "undefined" condition option should be created and made available for multiselect conditions and "uncategorised" for category conditions and people can combine them to get the results we need
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- [x ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.