Issues:
When i want to filter commission type = cobroke-commission, after i filter, it only come out one result, but the correct result should be two.
Result:
So, i try to write the query out to check the query
We can write the query before returning it, and the key point is that we need to add (string) to the $query because it ensures the query is properly converted to a string before execution.
Write File:
In the written file, we can see that the query consists of three WHERE clauses, but the third one is for sales_type, which we did not include in the filters.
Back in the frontend view, we can see that the sales type is already auto-selected even before we make a selection.
This is because the XML field does not have a default value or a header specified.
So, solution is adding a header to the xml field like:
Revised frontend view
Now, when we filter again, it should not have any issues
The query will no longer include the WHERE clause for sales type
Summary:
Setting a header for the filter XML field is important to avoid an extra WHERE clause in the query. It also enhances user experience by making the filter dropdown more user-friendly, especially when a header like '--Select Sales Type--' is provided.