I have built a Product Filter module that pulls data from our Hubd instance.
What I am having an issue with is one of the hubd columns is a multiselect column type. I have named this ‘Layer Type’ (layer_type).
Within the module i have set up, I have linked this up with a multiselect choice field type.
I originally had this all set up as just a standard select field (one choice only), though the spec has changed to multiselect.
I updated the code to the below, though it is only displaying products if they have all selected values rather than one or another.
{% if “comfort” is in item.filtering.filter_by_layer %}
{% set queryparam = queryparam ~ “&layer_type__contains=Comfort Layer” %}
{% endif %}
{% if “filling” is in item.filtering.filter_by_layer %}
{% set queryparam = queryparam ~ “&layer_type__contains=Filling Material” %}
{% endif %}
{% if “insulator_pad” is in item.filtering.filter_by_layer %}
{% set queryparam = queryparam ~ “&layer_type__contains=Insulator Pad” %}
{% endif %}
{% if “air_filter_mats” is in item.filtering.filter_by_layer %}
{% set queryparam = queryparam ~ “&layer_type__contains=Air Filter Mats” %}
{% endif %}
{% if “liquid_filters” is in item.filtering.filter_by_layer %}
{% set queryparam = queryparam ~ “&layer_type__contains=Liquid Filters” %}
{% endif %}
{% if “core_material” is in item.filtering.filter_by_layer %}
{% set queryparam = queryparam ~ “&layer_type__contains=Core Material” %}
{% endif %}
{% if “premium” is in item.filtering.filter_by_layer %}
{% set queryparam = queryparam ~ “&layer_type__contains=Premium” %}
{% endif %}
{% if “protective” is in item.filtering.filter_by_layer %}
{% set queryparam = queryparam ~ “&layer_type__contains=Protective” %}
{% endif %}
Any help to make the work for multiselect would be much appreciated.
Thanks in advance.