{% set _rout = app.request.attributes.get('_route') %}
{% set all_query = app.request.query.all %}
{% set sort = app.request.query.get('sort') %}
{% set direction = app.request.query.get('direction') %}
{% if location %}
{% set all_query = all_query|merge({'location': location.slug}) %}
{% endif %}
<select class="custom-dropdown dropup hide-tick btn-label" onchange="javascript:location.href = sortList.getUrl(
{
sortBy: {
key: 'sort',
value: this.value
},
sortOrder: {
key: 'direction',
value: this.options[this.selectedIndex].getAttribute('order')
}
});">
<option selected disabled>{{ 'layout.sort_results'|trans }}</option>
<option value="price" order="asc"
{% if sort == 'price' and direction == 'asc' %} selected {% endif %}
>
{{ 'layout.price_asc'|trans }}
</option>
<option value="price" order="desc"
{% if sort == 'price' and direction == 'desc' %} selected {% endif %}
>
{{ 'layout.price_desc'|trans }}
</option>
<option value="pricePerMeter" order="asc"
{% if sort == 'pricePerMeter' and direction == 'asc' %} selected {% endif %}
>
{{ 'layout.price_meter_asc'|trans }}
</option>
<option value="pricePerMeter" order="desc"
{% if sort == 'pricePerMeter' and direction == 'desc' %} selected {% endif %}
>
{{ 'layout.price_meter_desc'|trans }}
</option>
</select>