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 }}{% if loop.last == false %}, {% endif %}
  15.             {% endfor %}
  16.         };
  17.         
  18.         $(function() {
  19.             // 表示件数を変更
  20.             $('.disp-number').change(function() {
  21.                 var dispNumber = $(this).val();
  22.                 $('#disp_number').val(dispNumber);
  23.                 $('#pageno').val(1);
  24.                 $("#form1").submit();
  25.             });
  26.             // 並び順を変更
  27.             $('.order-by').change(function() {
  28.                 var orderBy = $(this).val();
  29.                 $('#orderby').val(orderBy);
  30.                 $('#pageno').val(1);
  31.                 $("#form1").submit();
  32.             });
  33.             $('.add-cart').on('click', function(e) {
  34.                 var $form = $(this).parents('li').find('form');
  35.                 // 個数フォームのチェック
  36.                 var $quantity = $form.parent().find('.quantity');
  37.                 if ($quantity.val() < 1) {
  38.                     $quantity[0].setCustomValidity('{{ '1以上で入力してください。'|trans }}');
  39.                     setTimeout(function() {
  40.                         loadingOverlay('hide');
  41.                     }, 100);
  42.                     return true;
  43.                 } else {
  44.                     $quantity[0].setCustomValidity('');
  45.                 }
  46.                 e.preventDefault();
  47.                 $.ajax({
  48.                     url: $form.attr('action'),
  49.                     type: $form.attr('method'),
  50.                     data: $form.serialize(),
  51.                     dataType: 'json',
  52.                     beforeSend: function(xhr, settings) {
  53.                         // Buttonを無効にする
  54.                         $('.add-cart').prop('disabled', true);
  55.                     }
  56.                 }).done(function(data) {
  57.                     // カートブロックを更新する
  58.                     $.ajax({
  59.                         url: '{{ url('block_cart') }}',
  60.                         type: 'GET',
  61.                         dataType: 'html'
  62.                     }).done(function(html) {
  63.                         $('.ec-headerRole__cart').html(html);
  64.                     });
  65.                     window.location.href = "{{ url('cart') }}";
  66.                 }).fail(function(data) {
  67.                     alert('{{ 'カートへの追加に失敗しました。'|trans }}');
  68.                 }).always(function(data) {
  69.                     // Buttonを有効にする
  70.                     $('.add-cart').prop('disabled', false);
  71.                 });
  72.             });
  73.             $('.reload').on('click', function(event) {
  74.                 location.reload();
  75.             });
  76.         });
  77.         $('.ec-modal-overlay, .ec-modal .ec-inlineBtn--cancel').on('click', function() {
  78.             $('.ec-modal').hide()
  79.         });
  80.     </script>
  81. {% endblock %}
  82. {% block main %}
  83. {% if search_form.category_id.vars.errors|length > 0 %}
  84. <div class="ec-searchnavRole">
  85.     <p class="errormsg text-danger">{{ 'ご指定のカテゴリは存在しません'|trans }}</p>
  86. </div>
  87. {% else %}
  88. <div class="ec-searchnavRole">
  89.     <form name="form1" id="form1" method="get" action="?">
  90.         {% for item in search_form %}
  91.             <input type="hidden" id="{{ item.vars.id }}"
  92.                         name="{{ item.vars.full_name }}"
  93.                         {% if item.vars.value is not empty %}
  94.                         value="{{ item.vars.value }}" 
  95.                         {% endif %}
  96.                         />
  97.         {% endfor %}
  98.     </form>
  99.     <div class="ec-searchnavRole__topicpath">
  100.         <ol class="ec-topicpath">
  101.             <li class="ec-topicpath__item"><a href="{{ url('product_list') }}">{{ '全て'|trans }}</a>
  102.             </li>
  103.             {% if Category is not null %}
  104.                 {% for Path in Category.path %}
  105.                     <li class="ec-topicpath__divider">|</li>
  106.                     <li class="ec-topicpath__item{% if loop.last %}--active{% endif %}"><a
  107.                         href="{{ url('product_list') }}?category_id={{ Path.id }}">{{ Path.name }}</a>
  108.                     </li>
  109.                 {% endfor %}
  110.             {% endif %}
  111.             {% if search_form.vars.value and search_form.vars.value.name %}
  112.                 <li class="ec-topicpath__divider">|</li>
  113.                 <li class="ec-topicpath__item">{{ '「%name%」の検索結果'|trans({ '%name%': search_form.vars.value.name }) }}</li>
  114.             {% endif %}
  115.         </ol>
  116.     </div>
  117.     <div>
  118.         <h3 style="width:940px;color:black;height:40px;">物件一覧表示</h3>
  119.     </div>
  120.     <div class="ec-searchnavRole__infos">
  121.         <div class="ec-searchnavRole__counter"style="width:600px;">
  122.             {% if pagination.totalItemCount > 0 %}
  123.                 {{ '<span class="ec-font-bold">%count%件</span><span>の物件がございます</span>'|trans({ '%count%': pagination.totalItemCount })|raw }}
  124.                 <div class="ec-pagerRole">
  125.                     {% include "pager.twig" with {'pages': pagination.paginationData} %}
  126.                 </div>
  127.             {% else %}
  128.                 <span>{{ 'お探しの物件はございません'|trans }}</span>
  129.             {% endif %}
  130.         </div>
  131.         {% if pagination.totalItemCount > 0 %}
  132.             <div class="ec-searchnavRole__actions">
  133.                 <div class="ec-select">
  134.                     {{ form_widget(search_form.disp_number, {'id': '', 'attr': {'class': 'disp-number'}}) }}
  135.                     {{ form_widget(search_form.orderby, {'id': '', 'attr': {'class': 'order-by'}}) }}
  136.                 </div>
  137.             </div>
  138.         {% endif %}
  139.         </div>
  140.     </div>
  141.     <div id="right_column_mod" style="padding-left:15px;">
  142.         {% if pagination.totalItemCount > 0 %}
  143.             {% for Product in pagination %}
  144.             <li class="ec-shelfGrid__item">
  145.                 {% set productClass = Product.getProductClasses() %}
  146.                 {% set cartItem = repository('Eccube\\Entity\\CartItem').findBy({ProductClass: productClass[0]}) %}
  147.             <div class="box_021">
  148.                 <a href="{{ url('product_detail', {'id': Product.id}) }}">
  149.                     <h4 class="bold" style="background-image:url();">
  150.                         <a href="{{ url('product_detail', {'id': Product.id}) }}">{{ Product.name }}</a>
  151.                     </h4>
  152.                     <p style="margin:3px 0;">
  153.                         {{Product.main_comment}}
  154.                     </p>
  155. <!--product_img start-->
  156.                      <div class="product_img_03_list" style="width:315px;"><a href="{{ url('product_detail', {'id': Product.id}) }}">
  157.                         {% if Product.main_image is null %}
  158.                         <img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}" width="310" alt="" />
  159.                         {% else %}
  160.                         <img src="{{ asset(Product.main_image|no_image_product, 'save_image') }}" width="310" alt="" />
  161.                         {% endif %}
  162.                         <!--アイコン-->
  163.                         <!--商品ステータス-->
  164.                         <ul style="margin-top:3px;"><ul>                                                                                                                                                                                                          </li></ul>
  165.                         <!--商品ステータス-->
  166.                         <!--アイコン-->
  167.                     </div>
  168.                 </a>
  169. <!--product_cap start-->
  170.                     <div class="product_cap_03">
  171.                         <div class="box_04 clearfix" style="padding-top:0px;">
  172.                             <table cellspacing="1" cellpadding="0" summary="" style="width:560px;padding: 0px;margin: 0px 0px 0px 0px;">
  173.                                 <tr>
  174.                                     <th style="width:140px; padding:5px; background-color:#3A6A9B; color:#FFF; text-align:center; font-weight:normal;">物件種別</th>
  175.                                     <td style="padding: 5px;text-align : left; background-color:#eef;color:#000000;width:120px;">{{Product.syubetu}}</td>
  176.                                     <th style="width:140px; padding:5px; background-color:#3A6A9B; color:#FFF; text-align:center; font-weight:normal;">物件種目</th>
  177.                                     <td style="padding: 5px;text-align : left; background-color:#eef; color:#000000">{{Product.syumoku}}</td>
  178.                                 </tr>
  179.                                 <tr>
  180.                                     <th style="width:140px; padding:5px; background-color:#3A6A9B; color:#FFF; text-align:center; font-weight:normal;">所在地</th>
  181.                                     <td colspan="3" style="padding: 5px;text-align : left; background-color:#eef; color:#000000;width:120px;">{{Product.pref}}{{Product.ku}}{{Product.adDetail}}</td>
  182.                                 </tr>
  183.                                 <tr>
  184.                                     <th style="; padding:5px; background-color:#3A6A9B; color:#FFF; text-align:center; font-weight:normal;">沿線・駅・交通</th>
  185.                                     <td colspan="3" style="padding: 5px;text-align : left; background-color:#eef; color:#000000;width:120px;">{{Product.ensen}}{{Product.station}}{{Product.stOther}}</td>
  186.                                 </tr>
  187.                                 <tr>
  188.                                     <th style="width:140px; padding:5px; background-color:#3A6A9B; color:#FFF; text-align:center; font-weight:normal;">間取り</th>
  189.                                     <td style="padding: 5px;text-align : left; background-color:#eef; color:#000000;width:120px;">{{Product.rmNum}}{{Product.rmType}}</td>
  190.                                     <th style="width:140px; padding:5px; background-color:#3A6A9B; color:#FFF; text-align:center; font-weight:normal;">建物面積    </th>
  191.                                     <td style="padding: 5px;text-align : left; background-color:#eef; color:#000000;width:120px;">{{Product.buildArea}} m<sup>2</sup></td>
  192.                                 </tr>
  193.                                 <tr>
  194.                                     <th style="width:140px; padding:5px; background-color:#3A6A9B; color:#FFF; text-align:center; font-weight:normal;">土地面積</th>
  195.                                     <td style="padding: 5px;text-align : left; background-color:#eef; color:#000000;width:120px;">{{Product.landArea}} m<sup>2</sup></td>
  196.                                     <th style="width:140px; padding:5px; background-color:#3A6A9B; color:#FFF; text-align:center; font-weight:normal;">価格</th>
  197.                                     <td style="padding: 5px;text-align : center; background-color:#eef; color:#000000;width:120px;">
  198.                                         {% if  Product.getPrice02IncTaxMax==0%}
  199.                                         <font style="color:red; font-weight:bolder;">ご成約済</font>
  200.                                         {% elseif Product.getPrice02IncTaxMax==1 %}
  201.                                         <font style="color:red; font-weight:bolder;">商 談 中</font>
  202.                                         {% else %}
  203.                                         <font style="color:red; font-weight:bolder;">{{Product.getPrice02IncTaxMax}}万円</font>
  204.                                         {% endif %}
  205.                                     </td>
  206.                                 </tr>
  207.                                 <tr style="height:40px;">
  208.                                     <td colspan="2" align="center">
  209.                                         <a href="{{ url('product_detail', {'id': Product.id}) }}" onmouseover="chgImg('../html/user_data/assets/images/b_detail_h.gif','detail1');" onmouseout="chgImg('../html/user_data/assets/images/b_detail.gif','detail1');">
  210.                                             <img src="../html/user_data/assets/images/b_detail.gif" width="110" height="21" alt="詳しくはこちら" name="detail1" id="detail1" />
  211.                                          </a>
  212.                                     </td>
  213.                                     <td>
  214.                                 {#コメントアウト解除でリスト登録制御
  215.                                 {% if cartItem != null %}
  216.                                     <div class="ec-productRole__btn">
  217.                                         <button type="button" class="ec-blockBtn--cancel" disabled="disabled">
  218.                                             {{ 'リストへ追加済です'|trans }}
  219.                                         </button>
  220.                                     </div>
  221.                                 {% else %}
  222.                                     {% if Product.getPrice02IncTaxMax!=0 and Product.getPrice02IncTaxMax!=1 %}
  223.                                 ここまで#}
  224.                                         {% set form = forms[Product.id] %}
  225.                                         <form name="form{{ Product.id }}" id="productForm{{ Product.id }}" action="{{ url('product_add_cart', {id:Product.id}) }}" method="post">
  226.                                             <div class="ec-productRole__actions">
  227.                                                 {% if form.classcategory_id1 is defined %}
  228.                                                     <div class="ec-select">
  229.                                                         {{ form_widget(form.classcategory_id1) }}
  230.                                                         {{ form_errors(form.classcategory_id1) }}
  231.                                                     </div>
  232.                                                     {% if form.classcategory_id2 is defined %}
  233.                                                         <div class="ec-select">
  234.                                                             {{ form_widget(form.classcategory_id2) }}
  235.                                                             {{ form_errors(form.classcategory_id2) }}
  236.                                                         </div>
  237.                                                     {% endif %}
  238.                                                 {% endif %}
  239.                                                 <!--<div class="ec-numberInput"><span>{{ '数量'|trans }}</span>--->
  240.                                                     {{ form_widget(form.quantity, { attr :  { 'class': 'quantity' , style : 'display:none;' } }) }}
  241.                                                     {{ form_errors(form.quantity) }}
  242.                                                 <!--</div>--->
  243.                                             </div>
  244.                                             {{ form_rest(form) }}
  245.                                         </form>
  246.                                         <div class="ec-productRole__btn">
  247.                                             <a type="button" class="add-cart" data-cartid="{{ Product.id }}" form="productForm{{ Product.id }}">
  248.                                                 <img src="../../html/user_data/assets/images/b_box_in.gif" width="108" height="21" alt="カゴに入れる"style="margin:5px 0 0 0;"/>
  249.                                             </a>
  250.                                         </div>
  251.                                     {#コメントアウト解除でリスト登録制御{% elseif Product.getPrice02IncTaxMax==0 %}
  252.                                         <div class="ec-productRole__btn">
  253.                                             <button type="button" class="ec-blockBtn--cancel" disabled="disabled">
  254.                                                 {{ 'ご成約済のためリストに追加できません'|trans }}
  255.                                             </button>
  256.                                         </div>
  257.                                     {% elseif Product.getPrice02IncTaxMax==1 %}
  258.                                         <div class="ec-productRole__btn">
  259.                                             <button type="button" class="ec-blockBtn--cancel" disabled="disabled">
  260.                                                 {{ '商談中のためリストに追加できません'|trans }}
  261.                                             </button>
  262.                                         </div>
  263.                                     {% endif %}
  264.                                 ここまで#}
  265.                                     </td>
  266.                                 {#コメントアウト解除でリスト登録制御
  267.                                 {% endif %}
  268.                                 ここまで#}
  269.                                 </tr>
  270.                             </div>
  271.                                 </table>
  272.                        </div>
  273. <!--/product_cap end-->
  274.                     </div>
  275.             </div>
  276.         </li>
  277.         {% endfor %}
  278.             <div class="ec-pagerRole">
  279.                 {% include "pager.twig" with {'pages': pagination.paginationData} %}
  280.             </div>
  281. <!--/product_img end-->
  282.         </div>
  283.     </div>
  284.     {% endif %}
  285. </div>
  286. {% endif %}
  287. {% endblock %}