Has anyone ever created a dynamic comparison table similar to Apples?
I’ve tried using the below code, cloning it and tweaking each one by changing any key point from 1 to 2, 3 etc (i.e. showing 3 lists), but I can’t get it to work.
Similar to Apples, at the end of the URL my test page updates with the query for example ?house_type=16 but unlike Apple, I’m unable to figure out how to add to this with the other lists.
Any ideas?
<table class="filter_container"><!-- Table 1 -->
<tr>
<td>
<!-- Filter -->
<form id="filter1" method="get">
<select name="house_type" form="filter1" onChange="this.form.submit()">
<option value="show-all">Show All</option>
{% set house_types1 = hubdb_table_column(1234567, "house_type").options %}
{% for choice1 in house_types1 %}
{% set house_type_list1 = house_type_list1~choice1.id|list %}
{% if choice1.id == request.query_dict.house_type %}
<option selected="selected" value="{{ choice1.id }}">{{ choice1.name }}</option>
{% else %}
<option value="{{ choice1.id }}">{{ choice1.name }}</option>
{% endif %}
{% endfor %}
</select>
</form>
<!-- Query Parameters -->
{% set queryparam1 = "" %}
{% if request.query_dict.house_type in ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28"] %}
{% set queryparam1 = queryparam1 ~ "house_type="~request.query_dict.house_type|urlencode %}
{% endif %}
{% if request.query_dict.house_type == "show-all" %}
{% set queryparam1 = queryparam1 ~ "&orderBy=house_type" %}
{% endif %}
{% set table1 = hubdb_table_rows(1234567, queryparam1) %}
{% if table1 == [] %}
<p class='align-center'>Sorry, no listings found for that Search. Try changing your filter and search again.</p>
{% else %}
{% for row in table1 %}
<div class="sitename">
House Name: {{ row["house_type"].name}} <br>
Ref: {{ row["house_type_ref"]}}
</div>
{% endfor %}
{% endif %}
</td>
</tr>
</table>