themes/BootstrapTheme/templates/bundles/MonsieurBizSyliusSearchPlugin/Search/_sorting.html.twig line 5

Open in your IDE?
  1. {% if result.count > 0 %}
  2.     {% set route = app.request.attributes.get('_route') %}
  3.     {% set route_parameters = app.request.attributes.get('_route_params')|merge(app.request.query.all) %}
  4.     {% set criteria = app.request.query.get('criteria', {}) %}
  5.     {% set default_path = path(route, route_parameters|merge({'sorting': null, 'criteria': criteria})) %}
  6.     {% set from_a_to_z_path = path(route, route_parameters|merge({'sorting': {'name': 'asc'}, 'criteria': criteria})) %}
  7.     {% set from_z_to_a_path = path(route, route_parameters|merge({'sorting': {'name': 'desc'}, 'criteria': criteria})) %}
  8.     {% set oldest_first_path = path(route, route_parameters|merge({'sorting': {'created_at': 'asc'}, 'criteria': criteria})) %}
  9.     {% set newest_first_path = path(route, route_parameters|merge({'sorting': {'created_at': 'desc'}, 'criteria': criteria})) %}
  10.     {% set cheapest_first_path = path(route, route_parameters|merge({'sorting': {'price': 'asc'}, 'criteria': criteria})) %}
  11.     {% set most_expensive_first_path = path(route, route_parameters|merge({'sorting': {'price': 'desc'}, 'criteria': criteria})) %}
  12.     {% if app.request.query.get('sorting') is empty %}
  13.         {% set current_sorting_label = 'sylius.ui.by_position'|trans|lower %}
  14.     {% elseif app.request.query.get('sorting').name is defined and app.request.query.get('sorting').name == 'asc'%}
  15.         {% set current_sorting_label = 'sylius.ui.from_a_to_z'|trans|lower %}
  16.     {% elseif app.request.query.get('sorting').name is defined and app.request.query.get('sorting').name == 'desc'%}
  17.         {% set current_sorting_label = 'sylius.ui.from_z_to_a'|trans|lower %}
  18.     {% elseif app.request.query.get('sorting').created_at is defined and app.request.query.get('sorting').created_at == 'desc'%}
  19.         {% set current_sorting_label = 'sylius.ui.newest_first'|trans|lower %}
  20.     {% elseif app.request.query.get('sorting').created_at is defined and app.request.query.get('sorting').created_at == 'asc'%}
  21.         {% set current_sorting_label = 'sylius.ui.oldest_first'|trans|lower %}
  22.     {% elseif app.request.query.get('sorting').price is defined and app.request.query.get('sorting').price == 'asc'%}
  23.         {% set current_sorting_label = 'sylius.ui.cheapest_first'|trans|lower %}
  24.     {% elseif app.request.query.get('sorting').price is defined and app.request.query.get('sorting').price == 'desc' %}
  25.         {% set current_sorting_label = 'sylius.ui.most_expensive_first'|trans|lower %}
  26.     {% else %}
  27.         {% set current_sorting_label = 'sylius.ui.by_position'|trans|lower %}
  28.     {% endif %}
  29.     <div class="dropdown dropdown-perso">
  30.         <button class="btn bg-primary-s rounded-circle2 dropdown-toggle text-white" type="button" id="dropdownMenuSorting" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">{{ 'sylius.ui.sort'|trans }}</button>
  31.           
  32.             <div class="dropdown-menu dropdown-menu-right" id="dropdownMenuSorting">
  33.                 {#<div class="text">{{ current_sorting_label }}</div>
  34.                 <i class="dropdown icon"></i>#}
  35.                 <div class="menu">
  36.                     <a class="item dropdown-item {% if current_sorting_label == 'sylius.ui.by_position'|trans|lower %}active{% endif %}" href="{{ default_path }}" data-text="{{ 'sylius.ui.by_position'|trans|lower }}">{{ 'sylius.ui.by_position'|trans }}</a>
  37.                     <a class="item dropdown-item  {% if current_sorting_label == 'sylius.ui.from_a_to_z'|trans|lower %}active{% endif %}" href="{{ from_a_to_z_path }}" data-text="{{ 'sylius.ui.from_a_to_z'|trans|lower }}">{{ 'sylius.ui.from_a_to_z'|trans }}</a>
  38.                     <a class="item dropdown-item  {% if current_sorting_label == 'sylius.ui.from_z_to_a'|trans|lower %}active{% endif %}" href="{{ from_z_to_a_path }}" data-text="{{ 'sylius.ui.from_z_to_a'|trans|lower }}">{{ 'sylius.ui.from_z_to_a'|trans }}</a>
  39.                     <a class="item dropdown-item  {% if current_sorting_label == 'sylius.ui.newest_first'|trans|lower %}active{% endif %}" href="{{ newest_first_path }}" data-text="{{ 'sylius.ui.newest_first'|trans|lower }}">{{ 'sylius.ui.newest_first'|trans }}</a>
  40.                     <a class="item dropdown-item  {% if current_sorting_label == 'sylius.ui.oldest_first'|trans|lower %}active{% endif %}" href="{{ oldest_first_path }}" data-text="{{ 'sylius.ui.oldest_first'|trans|lower }}">{{ 'sylius.ui.oldest_first'|trans }}</a>
  41.                     <a class="item dropdown-item  {% if current_sorting_label == 'sylius.ui.cheapest_first'|trans|lower %}active{% endif %}" href="{{ cheapest_first_path }}" data-text="{{ 'sylius.ui.cheapest_first'|trans|lower }}">{{ 'sylius.ui.cheapest_first'|trans }}</a>
  42.                     <a class="item  dropdown-item {% if current_sorting_label == 'sylius.ui.most_expensive_first'|trans|lower %}active{% endif %}" href="{{ most_expensive_first_path }}" data-text="{{ 'sylius.ui.most_expensive_first'|trans|lower }}">{{ 'sylius.ui.most_expensive_first'|trans }}</a>
  43.                 </div>
  44.             </div>
  45.         
  46.     </div>
  47. {% endif %}