La fonction de suggestion automatique permet d'affiner rapidement votre recherche en suggérant des correspondances possibles au fur et à mesure de la frappe.
juil. 22, 20206:31 AM - modifié juil. 22, 20206:33 AM
Contributeur de premier rang
Flexible table data
Résolue
Is it possible to add a choice field within the 'set table' line?
Currently I have the following line of code which works fine:
{% set table = hubdb_table_rows(module.table_id, "plot-status=Released&orderBy=class") %}
However I would like to add in a choice field {{ module.plotstatus }} to allow the content editor to select which hubdb data to display. Is this possible?
I've tried replacing "plot-status="Released with
plot-status={{ module.plotstatus }} but it doesnt work!
In addition to this, is it possible build on this command to pull in extra data but only if a particlar selection is made?
As it stands the relevant row will only show if the content editor selects it, but if they select for example "Available" from the choie field, can it also show "SpecialOffer" fields too and vice versa?
Haha well if it works, it works. In my earlier response I didn't understand that "SpecialOffer" was also an option from plot-status, so apologies for that.
If you wanted to cut a couple of lines you could do this:
{% set choice = "plot-status=" ~ module.select_status %}
{% if choice is string_containing "Available" %}
{% set choice = "&plot-status__in=Available,SpecialOffer&orderBy=price" %}
{% endif %}
{% set table = hubdb_table_rows(module.table_id, choice ~ "&orderBy=class") %}