There seems to be an issue if one creates a grouped filters of a transated field (i18n and field translation).

In order to translate "allowed values" of a "select list" in an "exposed form", I had to modify my view and filters , using translated fields instead of fields.

I use the field translation module (i18n)
I have set a filter using the field_name (translated) field in the view.
The grouped filter doesn't work => no results are shown

Before that change, a grouped filter on the normal field (not translated) worked well
Using the filter without the groups (single value filter) but with the translated filed works also correctly.

Thanks if you have any suggestion.

Comments

bendev’s picture

Component: Miscellaneous » exposed filters
bendev’s picture

the field used as exposed filter is a select list.

when I group the filters I rename the label and select several values among the allowed values. The operator selected is 'is one of'

when I display the sql query I see that the where clause is wrong .

it is (commerce_product_field_data_field_sku__field_data_field_taille.field_taille_value = '62', '68', '74') ))

where it should be
(commerce_product_field_data_field_sku__field_data_field_taille.field_taille_value IN '62', '68', '74') ))

bendev’s picture

I managed to find a solution to make it work but what I observed is very weird.

I had first to select the option "allow multiple values/selections" and save the view.
This had the effect to change the input field (before a select list and after multiple lines)

Then , I came back and unselected the "allow multiple values/selections" and resave the view to restore the look of the select inpuf field.

And only then it works as I would expect ... the sql query uses an "in" operator instead of "="

As I understand it, the "allow multiple values/selections" means the user may filter by selecting many value for a single criteria. However, with the use of grouped filter, even if the user select only one value, there can already be a many to one relationship and if user select e.g. size =X this can be translated in the sql query into size in (Y,Z, A)...

bendev’s picture

I observed the same issue on a website that doesn't use i18n so the issue is not related with translation.

I could solve it in the same ways as described hereabove in #3