app/template/default/Product/list.twig line 1

Open in your IDE?
  1. {#
  2. This file is part of EC-CUBE
  3. Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  4. http://www.ec-cube.co.jp/
  5. For the full copyright and license information, please view the LICENSE
  6. file that was distributed with this source code.
  7. #}
  8. {% extends 'default_frame.twig' %}
  9. {% set body_class = 'product_page' %}
  10. {% block javascript %}
  11.     <script>
  12.         eccube.productsClassCategories = {
  13. {% for Product in pagination %}
  14. "{{ Product.id|escape('js') }}" : {{ class_categories_as_json(Product)|raw }}
  15. {% if loop.last == false %},{% endif %}{% endfor %}
  16. };
  17. $(function () { // 表示件数を変更
  18. $('.disp-number').change(function () {
  19. var dispNumber = $(this).val();
  20. $('#disp_number').val(dispNumber);
  21. $('#pageno').val(1);
  22. $("#form1").submit();
  23. });
  24. // 並び順を変更
  25. $('.order-by').change(function () {
  26. var orderBy = $(this).val();
  27. $('#orderby').val(orderBy);
  28. $('#pageno').val(1);
  29. $("#form1").submit();
  30. });
  31. $('.add-cart').on('click', function (e) {
  32. var $form = $(this).parents('li').find('form');
  33. // 個数フォームのチェック
  34. var $quantity = $form.parent().find('.quantity');
  35. if ($quantity.val() < 1) {
  36. $quantity[0].setCustomValidity('{{ 'front.product.invalid_quantity'|trans }}');
  37. setTimeout(function () {
  38. loadingOverlay('hide');
  39. }, 100);
  40. return true;
  41. } else {
  42. $quantity[0].setCustomValidity('');
  43. } e.preventDefault();
  44. $.ajax({
  45. url: $form.attr('action'),
  46. type: $form.attr('method'),
  47. data: $form.serialize(),
  48. dataType: 'json',
  49. beforeSend: function (xhr, settings) { // Buttonを無効にする
  50. $('.add-cart').prop('disabled', true);
  51. }
  52. }).done(function (data) { // レスポンス内のメッセージをalertで表示
  53. $.each(data.messages, function () {
  54. $('#ec-modal-header').text(this);
  55. });
  56. $('.ec-modal').show()
  57. // カートブロックを更新する
  58. $.ajax({url: '{{ url('block_cart') }}', type: 'GET', dataType: 'html'}).done(function (html) {
  59. $('.ec-headerRole__cart').html(html);
  60. });
  61. }).fail(function (data) {
  62. alert('{{ 'front.product.add_cart_error'|trans }}');
  63. }).always(function (data) { // Buttonを有効にする
  64. $('.add-cart').prop('disabled', false);
  65. });
  66. });
  67. });
  68. $('.ec-modal-wrap').on('click', function (e) { // モーダル内の処理は外側にバブリングさせない
  69. e.stopPropagation();
  70. });
  71. $('.ec-modal-overlay, .ec-modal, .ec-modal-close, .ec-inlineBtn--cancel').on('click', function () {
  72. $('.ec-modal').hide()
  73. });
  74.     </script>
  75. {% endblock %}
  76. {% block main %}
  77.     <div class="pb-[120px] md:pb-20 w-full">
  78.         <div>
  79.             <div class="flex gap-4 md:gap-2 items-start mx-auto w-full pl-[10.625vw] md:pl-6 pt-[120px] md:pt-20 pb-10 md:pb-1">
  80.                 <hr class="md:h-[64px] h-[120px] w-[2px] bg-gradient-to-b from-[#ADAAA6] to-[#F0EDE900] border-none">
  81.                 <h1 class="text-2xl md:text-xl font-light leading-9 tracking-widest">LINEUP</h1>
  82.             </div>
  83.             {% set breadcrumbs = [{'name': "LINEUP" }] %}
  84.             {{ include('Block/breadcrumb.twig') }}
  85.         </div>
  86.         {% if pagination.totalItemCount > 0 %}
  87.             <div class="w-full flex flex-col items-center lg:px-6 justify-center">
  88.                 <ul class="grid grid-cols-2 md:flex md:flex-col gap-x-[140px] lg:gap-x-20 gap-y-[120px] md:gap-y-10 w-full md:items-center justify-center max-w-[800px]">
  89.                     {% for Product in pagination %}
  90.                         <a href="{{ url('product_detail', { id: Product.id }) }}">
  91.                             <li class="flex flex-col items-center text-center w-[330px] lg:w-full hover">
  92.                                 <div class="flex flex-col items-center">
  93.                                     <img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}" alt="{{ Product.name }}" {% if loop.index > 5 %} loading="lazy" {% endif %} class="w-[330px] h-[330px] md:w-[327px] md:h-[327px] mb-10 md:mb-6">
  94.                                     <div class="mb-6">
  95.                                         <p class="font-light font-notoserif text-[32px] mb-2 tracking-[6.4px]">{{ Product.name }}</p>
  96.                                         <p class="text-xs font-notoserif font-light tracking-wide">{{Product.name_kana}}</p>
  97.                                     </div>
  98.                                     <p class="h-14 mb-4 text-sm text-center leading-7 flex items-center">{{ Product.description_list|raw|nl2br }}</p>
  99.                                     <div class="flex items-baseline gap-1 mb-6">
  100.                                         <p class="text-xl leading-9">
  101.                                             {% if Product.hasProductClass %}
  102.                                                 {% if Product.getPrice02Min == Product.getPrice02Max %}
  103.                                                     {{ Product.getPrice02IncTaxMin| number_format }}
  104.                                                 {% else %}
  105.                                                     {{ Product.getPrice02IncTaxMin| number_format }}
  106.                                                     ~
  107.                                                     {{ Product.getPrice02IncTaxMax| number_format}}
  108.                                                 {% endif %}
  109.                                             {% else %}
  110.                                                 {{ Product.getPrice02IncTaxMin| number_format }}
  111.                                             {% endif %}
  112.                                         </p>
  113.                                         <p class="text-xs leading-4 font-medium">円(税込)</p>
  114.                                     </div>
  115.                                 </div>
  116.                                 <div href="{{ url('product_detail', {'id': Product.id}) }}" class="w-[238px] border-black border py-3 rounded-[3px] md:w-[258px] mb-10 text-sm">詳しくはこちら</div>
  117.                                 <div class="w-[330px] h-[88px] sm:w-[100vw] md:mx-[calc(50%-50vw)] sm:px-[calc(50%-50vw)] bg-background-default">
  118.                                     <p class="px-8 py-4 text-center leading-7 text-sm">{{Product.free_area|raw|nl2br}}</p>
  119.                                 </div>
  120.                             </li>
  121.                         </a>
  122.                     {% endfor %}
  123.                 </ul>
  124.             </div>
  125.             <div class="ec-pagerRole">
  126.                 {% include "pager.twig" with {'pages': pagination.paginationData} %}
  127.             </div>
  128.         {% endif %}
  129.     </div>
  130. {% endblock %}