templates/product/product_list.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% import "macros/user_macro.html.twig" as userMacro %}
  3. {% set title = 'product.head_title'|trans %}
  4. {% set breadcrumb = {
  5.     ('product.title'|trans): path('product_index'),
  6. } %}
  7. {% if searchObject.shopid is not null %}
  8.     {% set title = title ~ ' - ' ~ 'product.shop'|trans ~ ' ' ~ searchObject.shopid.name %}
  9.     {% set breadcrumb = breadcrumb|merge({
  10.         ('product.shops'|trans): path('shop_list'),
  11.         (searchObject.shopid.name): path('shop_view', {id: searchObject.shopid.id}),
  12.         ('product.referenced'|trans): path('product_index', {shopid: searchObject.shopid.id})
  13.     }) %}
  14. {% elseif categsTree is not empty %}
  15.     {% set title = title ~ ' - ' %}
  16.     {% for categTree in categsTree %}
  17.         {% set breadcrumb = breadcrumb|merge({
  18.             (categTree.name): path('product_index', {categid: categTree.id})
  19.         }) %}
  20.         {% set title = title ~ categTree.name %}
  21.         {% if loop.index < categsTree|length %}
  22.             {% set title = title ~ ' : ' %}
  23.         {% endif %}
  24.     {% endfor %}
  25. {% endif %}
  26. {% if searchObject.brandid is not null %}
  27.     {% set title = title ~ ' - ' ~ 'product.brand'|trans ~ ' ' ~ searchObject.brandid.name %}
  28. {% endif %}
  29. {% block body %}
  30.     {% include 'product/partials/tabs.html.twig' with {activeTab: 'all'} %}
  31.     <div class="tipscontainer">
  32.         <div class="tipscontent2">
  33.             {% if searchObject.brandid is not null %}
  34.                 <img src="{{ asset('images/main/icons/cart.png') }}" alt="" /> <a href="{{ path('shop_list', {brandid: searchObject.brandid.id}) }}">{{ 'product.see_reseller_brand'|trans({'%name%': searchObject.brandid.name}) }}</a><br />
  35.                 <div class="sep1"></div>
  36.             {% endif %}
  37.             {% if is_granted(constant("App\\Entity\\User::ROLE_PRODUCT_ADMIN")) %}
  38.                 <img src="{{ asset('images/main/icons/add.png') }}" alt="">
  39.                 <a href="{{ path('product_create') }}">{{ 'product.create'|trans }}</a><br>
  40.                 <img src="{{ asset('images/main/icons/cart.png') }}" alt="">
  41.                 <a href="{{ path('brand_list') }}">{{ 'product.all_brands'|trans }}</a><br>
  42.                 <img src="{{ asset('images/main/icons/cart.png') }}" alt="">
  43.                 <a href="{{ path('company_list') }}">{{ 'product.all_societies'|trans }}</a><br>
  44.             {% endif %}
  45.         </div>
  46.     </div>
  47.     <div class="maincontent">
  48.         <div class="partbox">
  49.             {{ 'product.description'|trans }}<br><br>
  50.         </div>
  51.     </div>
  52.     <div class="sep1" style="clear: both;"></div>
  53.     <div class="maincontentlarge" style="clear: both;">
  54.         <div class="partbox">
  55.             {% include 'product/partials/sidebar_product_list.html.twig' %}
  56.             <div style="margin-left: 205px;">
  57.                 <div style="margin-bottom: 15px;" class="partbox sorting">
  58.                     <a {% if sort is null or sort == 'p.createdAt' %}class="active disabled"{% endif %}
  59.                        href="{{ path('product_index', app.request.query.all|merge({sort: 'p.createdAt', direction: 'desc'})) }}">{{ 'product.filter.most_recent'|trans }}</a>
  60.                     <span class="vertsep"></span>
  61.                     <a {% if sort == 'p.name' %}class="active disabled"{% endif %}
  62.                        href="{{ path('product_index', app.request.query.all|merge({sort: 'p.name', direction: 'asc'})) }}">{{ 'product.filter.by_name'|trans }}</a>
  63.                     <span class="vertsep"></span>
  64.                     <a {% if sort == 'p.totalFavorite' %}class="active disabled"{% endif %}
  65.                        href="{{ path('product_index', app.request.query.all|merge({sort: 'p.totalFavorite', direction: 'desc'})) }}">{{ 'product.filter.most_liked'|trans }}</a>
  66.                 </div>
  67.                 {% if products is empty %}
  68.                 {{ 'product.not_found'|trans }}
  69.                 {% else %}
  70.                 <div class="row">
  71.                     <div class="col-md-12">
  72.                         {{ knp_pagination_render(products, '@KnpPaginator/Pagination/twitter_bootstrap_v4_pagination.html.twig') }}
  73.                     </div>
  74.                 </div>
  75.                 {{ include ('product/partials/list.html.twig') }}
  76.                 <div class="row">
  77.                     <div class="col-md-12">
  78.                         {{ knp_pagination_render(products, '@KnpPaginator/Pagination/twitter_bootstrap_v4_pagination.html.twig') }}
  79.                     </div>
  80.                 </div>
  81.                 {% endif %}
  82.             </div>
  83.         </div>
  84.     </div>
  85.     <div class="tipscontainer">
  86.         {#@todo publicité#}
  87.         <div class="tipstitle">{{ 'product.add_product'|trans }}</div>
  88.         <div class="tipscontent">
  89.             {{ 'product.add_product_description'|trans }}
  90.         </div>
  91.     </div>
  92.     <div class="maincontent">
  93.         <div class="partbox">
  94.             <h2>{{ 'product.last_product_review'|trans }}</h2>
  95.             <div>
  96.                 {% for comment in comments %}
  97.                     <div class="commentbox" style="float: left; width: 280px; margin-bottom: 10px; min-height: 145px; margin-right: 15px;">
  98.                         <b><a href="{{ path('product_view', {id: comment.product.id}) }}#comments">{{ comment.product.name }}</a>&nbsp;:&nbsp;</b><br>
  99.                         {% if comment.createdBy %}
  100.                             {{ userMacro.avatarDiv(comment.createdBy, "float: left; margin-right: 5px; margin-bottom: 5px; clear: right;", 2, 'small') }}
  101.                         {% endif %}
  102.                         <div style="zmargin-left: 60px; font-size: 11px;">
  103.                             {{ comment.commentresume|truncate(180,false,'[...]')|raw }}
  104.                         </div>
  105.                         <div style="zfloat: right; color: #999999; clear: both;" class="title4">
  106.                             <img src="{{ asset('/images/main/stars' ~ comment.voteValue ~ '.png') }}" alt="" />
  107.                             <span class="vertsep"></span>
  108.                             {{ comment.createdAt|momentFromNow }}
  109.                         </div>
  110.                     </div>
  111.                 {% endfor %}
  112.             </div>
  113.         </div>
  114.         <div class="partbox" style="clear: both;">
  115.             <h2>{{ 'product.moderator_team'|trans }}</h2>
  116.             {% for moderator in moderators if moderators is not empty %}
  117.                 {% if moderator %}
  118.                     {{ userMacro.avatarDiv(moderator, "", 2, 'small', true) }}
  119.                 {% endif %}
  120.             {% endfor %}
  121.         </div>
  122.     </div>
  123. {% endblock %}