CMS Development

kpkreative
Participante

Get Hubd Multiselect to pull through

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.

0 Me gusta
1 Respuesta 1
Jaycee_Lewis
Administrador de la comunidad
Administrador de la comunidad

Get Hubd Multiselect to pull through

Hi, @kpkreative 👋 Thanks for reaching out! Hey @LMeert @rlopez have you tackled anything like what @kpkreative is describing? Thank you very much! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Me gusta