templates/main/shop/index.html.twig line 1

Open in your IDE?
  1. {% extends base ~ "/base.html.twig" %}
  2. {% import "macros/category.html.twig" as categoryMacro %}
  3. {% block title %}Tous nos articles{% endblock %}
  4. {% block javascripts %}
  5. <script>
  6.     $(document).ready(function () {
  7.         $(document).on('change', '#sortby', function () {
  8.             let val = $(this).val();
  9.             window.location.href = "/change-sort/" + val;
  10.         });
  11.     })
  12. </script>
  13. {% endblock %}
  14. {% block main %}
  15. {% set route_name = app.request.get('_route') %}
  16. <main class="main">
  17.     <nav aria-label="breadcrumb" class="breadcrumb-nav mb-0">
  18.         <div class="container d-flex align-items-center">
  19.             <ol class="breadcrumb">
  20.                 <li class="breadcrumb-item">
  21.                     <a href="/">Accueil</a>
  22.                 </li>
  23.                 {% if route_name == 'articles' %}
  24.                     <li class="breadcrumb-item active" aria-current="page">{{'Store'|trans}}</li>
  25.                 {% elseif route_name  == 'articles_category' %}
  26.                 {% set filtre1 = categories.filtre1(app.request.get('category')) %}
  27.                 <li class="breadcrumb-item">
  28.                     <a href="{{ path('articles') }}">{{'Store'|trans}}</a>
  29.                 </li>
  30.                 <li class="breadcrumb-item">
  31.                     <a {{ categoryMacro.href_category(filtre1) }} >
  32.                         {{ filtre1.title}}
  33.                     </a>
  34.                 </li>
  35.                 {% endif %}
  36.             </ol>
  37.             <!-- End .pager-nav -->
  38.         </div>
  39.         <!-- End .container -->
  40.     </nav>
  41.     <div class="page-content pt-2">
  42.         <div class="container">
  43.             {% include "includes/_alerte.html.twig" %}
  44.             <div class="row">
  45.                 <div class="col-lg-9">
  46.                     <div class="toolbox">
  47.                         <div class="toolbox-left">
  48.                             <div class="toolbox-info">
  49.                                 {{'Showing'|trans}} <span>{{ articles|length}} {{'of'|trans}} {{ articles.totalItemCount }}</span>
  50.                                 {{'Products'|trans}}
  51.                             </div><!-- End .toolbox-info -->
  52.                         </div><!-- End .toolbox-left -->
  53.                         <div class="toolbox-right">
  54.                             <div class="toolbox-sort">
  55.                                 <label for="sortby">{{'Sort by'|trans}}:</label>
  56.                                 <div class="select-custom">
  57.                                     {% set sort_by = app.request.session.get('sort_by') %}
  58.                                     <select name="sortby" id="sortby" class="form-control">
  59.                                         <option {{ ((sort_by=='vide' ) or (sort_by is null) )? 'selected' :'' }} value="vide">
  60.                                             {# {{'No sort'|trans}} #}
  61.                                             Non trier
  62.                                         </option>
  63.                                         <option {{ (sort_by=='price:ASC' )? 'selected' :'' }} value='price:ASC'>
  64.                                             {{'    Ascending price'|trans}}
  65.                                             {# Prix Croissant #}
  66.                                         </option>
  67.                                         <option {{ (sort_by=='price:DESC' )? 'selected' :'' }} value='price:DESC'>
  68.                                             {{'Price Descending'|trans}}
  69.                                             {# Prix Déscroissant #}
  70.                                         </option>
  71.                                         {# <option {{ (sort_by=='created_at:ASC' )? 'selected' :'' }}
  72.                                             value='created_at:ASC'>
  73.                                             {{'Date Ascending'|trans}}
  74.                                         </option>
  75.                                         <option {{ (sort_by=='created_at:DESC' )? 'selected' :'' }}
  76.                                             value='created_at:DESC'>
  77.                                             {{'Descending Date'|trans}}
  78.                                         </option> #}
  79.                                     </select>
  80.                                 </div>
  81.                             </div><!-- End .toolbox-sort -->
  82.                             {% set cols_article = app.request.session.get('cols') %}
  83.                             <div class="toolbox-layout">
  84.                                 <a href="{{ path('cols',{cols:'list'}) }}"
  85.                                     class="btn-layout {{ ( cols_article == 'list' or cols_article is null) ? 'active':'' }}">
  86.                                     <svg width="16" height="10">
  87.                                         <rect x="0" y="0" width="4" height="4"></rect>
  88.                                         <rect x="6" y="0" width="10" height="4"></rect>
  89.                                         <rect x="0" y="6" width="4" height="4"></rect>
  90.                                         <rect x="6" y="6" width="10" height="4"></rect>
  91.                                     </svg>
  92.                                 </a>
  93.                                 {# <a href="{{ path('cols',{cols:'2cols'}) }}" class="btn-layout">
  94.                                     <svg width="10" height="10">
  95.                                         <rect x="0" y="0" width="4" height="4"></rect>
  96.                                         <rect x="6" y="0" width="4" height="4"></rect>
  97.                                         <rect x="0" y="6" width="4" height="4"></rect>
  98.                                         <rect x="6" y="6" width="4" height="4"></rect>
  99.                                     </svg>
  100.                                 </a> #}
  101.                                 {# <a href="{{ path('cols',{cols:'3cols'}) }}" class="btn-layout">
  102.                                     <svg width="16" height="10">
  103.                                         <rect x="0" y="0" width="4" height="4"></rect>
  104.                                         <rect x="6" y="0" width="4" height="4"></rect>
  105.                                         <rect x="12" y="0" width="4" height="4"></rect>
  106.                                         <rect x="0" y="6" width="4" height="4"></rect>
  107.                                         <rect x="6" y="6" width="4" height="4"></rect>
  108.                                         <rect x="12" y="6" width="4" height="4"></rect>
  109.                                     </svg>
  110.                                 </a> #}
  111.                                 <a href="{{ path('cols',{cols:'4cols'}) }}"
  112.                                     class="btn-layout {{ (cols_article == '4cols') ? 'active':'' }}">
  113.                                     <svg width="22" height="10">
  114.                                         <rect x="0" y="0" width="4" height="4"></rect>
  115.                                         <rect x="6" y="0" width="4" height="4"></rect>
  116.                                         <rect x="12" y="0" width="4" height="4"></rect>
  117.                                         <rect x="18" y="0" width="4" height="4"></rect>
  118.                                         <rect x="0" y="6" width="4" height="4"></rect>
  119.                                         <rect x="6" y="6" width="4" height="4"></rect>
  120.                                         <rect x="12" y="6" width="4" height="4"></rect>
  121.                                         <rect x="18" y="6" width="4" height="4"></rect>
  122.                                     </svg>
  123.                                 </a>
  124.                             </div><!-- End .toolbox-layout -->
  125.                         </div><!-- End .toolbox-right -->
  126.                     </div><!-- End .toolbox -->
  127.                     {% if cols_article == 'list' %}
  128.                     {% include base ~"/shop/_articles_list.html.twig" %}
  129.                     {% elseif cols_article == '4cols' %}
  130.                     {% include base ~"/shop/_articles_4cols.html.twig" %}
  131.                     {% else %}
  132.                     {% include base ~"/shop/_articles_list.html.twig" %}
  133.                     {% endif %}
  134.                 </div><!-- End .col-lg-9 -->
  135.                 
  136.                 <aside class="col-lg-3 order-lg-first">
  137.                     <div class="widget widget-categories">
  138.                         <h3 class="widget-title">{{ (route_name == 'articles_category')? app_name:'' }}</h3><!-- End .widget-title -->
  139.                             <a href="{{ path('articles') }}" class="article-all{{ (route_name == 'articles')? '-active':'' }}">
  140.                                 {{'All'|trans}}                    
  141.                             </a>    
  142.                         <div class="widget-body">    
  143.                             <div class="accordion" id="widget-cat-acc">
  144.                                 {% for category2 in categories.niveau2 %}
  145.                                 {% if category2.isActive %}
  146.                                     <div class="acc-item">
  147.                                         <h5>
  148.                                             <a role="button" data-toggle="collapse" href="#collapse-{{ category2.id }}" aria-expanded="false" aria-controls="collapse-{{ category2.id }}" class="collapsed">
  149.                                                 {{ category2.title}}
  150.                                             </a>
  151.                                         </h5>
  152.                                         <div id="collapse-{{ category2.id }}" class="collapse {{ (app.request.get('category2_slug') == category2.slug ) ? 'show':'' }}" data-parent="#widget-cat-acc" style="">
  153.                                             <div class="collapse-wrap">
  154.                                                 <ul>
  155.                                                 {% for category in category2.categorys %}
  156.                                                     {% if category.isActive %}
  157.                                                         
  158.                                                     <li><a {{ categoryMacro.href_category(category)}} class=" categorie {{ (app.request.get('category') == category.slug ) ? 'active':'' }}"> 
  159.                                                     {{ category.title }}  ( {{ categoryCount(category2.title, category.title)}} )
  160.                                                     
  161.                                                     </a></li>
  162.                                                     {% endif %}
  163.                                                 {% endfor %}
  164.                                                 </ul>
  165.                                             </div><!-- End .collapse-wrap -->
  166.                                         </div><!-- End .collapse -->
  167.                                     </div><!-- End .acc-item -->
  168.                                     {% endif %}
  169.                                 {% endfor %}
  170.                             </div><!-- End .accordion -->
  171.                             <ul>
  172.                                 <li>
  173.                                     <a href="/boutique/reductions" class="cat-select {{ app.request.attributes.get('category3') == "reductions"  ? 'active':'' }}">
  174.                                         Reductions
  175.                                     </a>
  176.                                 </li>
  177.                             </ul>
  178.                         </div><!-- End .widget-body -->
  179.                     </div>
  180.                     <div class="sidebar sidebar-shop">
  181.                         <div class="widget widget-clean">
  182.                             <label>Filters:</label>
  183.                             <a href="{{ path('articles') }}" class="sidebar-filter-clear">Annuler les filtres</a>
  184.                             {# <a href="#" class="">Clean All</a> #}
  185.                         </div><!-- End .widget widget-clean -->
  186.                         <div class="widget widget-collapsible">
  187.                             <form method="get">
  188.                             {% if app.request.get('mots') != '' %}
  189.                                 <input type="hidden" class="form-control" name="mots" value="{{app.request.get('mots')}}">
  190.                             {% endif %}
  191.                             
  192.                                 <div class="form-row">
  193.                                     <div class="form-group col-md-12 col-12">
  194.                                         <input type="number" id="minPrice" value="{{ app.request.get('minPrice') }}"
  195.                                             width="100px" name="minPrice" placeholder="Prix Min" class="form-control">
  196.                                     </div>
  197.                                     <div class="form-group col-md-12 col-12">
  198.                                         <input type="number" id="maxPrice" value="{{ app.request.get('maxPrice') }}"
  199.                                             width="100px" name="maxPrice" placeholder="Prix Max" class="form-control">
  200.                                     </div>
  201.                                     {# <div class="form-group col-md-12 col-12">
  202.                                         <select class="custom-select select2" style="height:41px;font-size:14px"
  203.                                             name="brand" id="brand">
  204.                                             <option value="">Toutes les Marques</option>
  205.                                             {% for item in brands %}
  206.                                             <option {{ app.request.get('brand')==item.name ? 'selected' :'' }}
  207.                                                 value="{{ item.name }}">{{ item.name }}</option>
  208.                                             {% endfor %}
  209.                                         </select>
  210.                                     </div> #}
  211.                                     {# <div class="form-group col-md-12 col-12">
  212.                                         <select class="custom-select" style="height:41px;font-size:14px" name="etat"
  213.                                             id="brand">
  214.                                             <option value="">Tous les états</option>
  215.                                             <option {{ app.request.get('etat')=='Neuf' ? 'selected' :'' }} value="Neuf">
  216.                                                 Neuf</option>
  217.                                             <option {{ app.request.get('etat')=='Reconditionné' ? 'selected' :'' }}
  218.                                                 value="Reconditionné">Reconditionné</option>
  219.                                             <option {{ app.request.get('etat')=='Occasion' ? 'selected' :'' }}
  220.                                                 value="Occasion">Occasion</option>
  221.                                         </select>
  222.                                     </div> #}
  223.                                     <div class="form-group col-md-2 col-12">
  224.                                         <button type="submit" width="90px" class="btn btn-primary">Appliquer</button>
  225.                                     </div>
  226.                                 </div>
  227.                             </form>
  228.                         </div><!-- End .widget -->
  229.                     </div><!-- End .sidebar sidebar-shop -->
  230.                 </aside><!-- End .col-lg-3 -->
  231.             </div><!-- End .row -->
  232.         </div><!-- End .container -->
  233.     </div><!-- End .page-content -->
  234. </main>
  235. <!-- End .main -->
  236. {% endblock %}