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.                 {% set SaleType = repository('Eccube\\Entity\\Master\\SaleType').findBy({id: productClass[0].SaleType}) %}
  148.                 {% if SaleType != null %}
  149.                 {% set SaleTypeName = SaleType[0].name %}
  150.                 {% else %}
  151.                 {% set SaleTypeName = '' %}
  152.                 {% endif %}
  153.             <div class="box_021">
  154.                 <a href="{{ url('product_detail', {'id': Product.id}) }}">
  155.                     <h4 class="bold" style="background-image:url();">
  156.                         <a href="{{ url('product_detail', {'id': Product.id}) }}">{{ Product.name }}</a>
  157.                     </h4>
  158.                     <p style="margin:3px 0;">
  159.                         {{Product.main_comment}}
  160.                     </p>
  161. <!--product_img start-->
  162.                      <div class="product_img_03_list" style="width:315px;"><a href="{{ url('product_detail', {'id': Product.id}) }}">
  163.                         {% if Product.main_image is null %}
  164.                         <img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}" width="310" alt="" />
  165.                         {% else %}
  166.                         <img src="{{ asset(Product.main_image|no_image_product, 'save_image') }}" width="310" alt="" />
  167.                         {% endif %}
  168.                         <!--アイコン-->
  169.                         <!--商品ステータス-->
  170.                         <ul style="margin-top:3px;"><ul>                                                                                                                                                                                                          </li></ul>
  171.                         <!--商品ステータス-->
  172.                         <!--アイコン-->
  173.                     </div>
  174.                 </a>
  175. <!--product_cap start-->
  176.                     <div class="product_cap_03">
  177.                         <div class="box_04 clearfix" style="padding-top:0px;">
  178.                             <table cellspacing="1" cellpadding="0" summary="" style="width:560px;padding: 0px;margin: 0px 0px 0px 0px;">
  179.                                 <tr>
  180.                                     <th style="width:140px; padding:5px; background-color:#3A6A9B; color:#FFF; text-align:center; font-weight:normal;">物件種別</th>
  181.                                     <td style="padding: 5px;text-align : left; background-color:#eef;color:#000000;width:120px;">{{SaleTypeName}}</td>
  182.                                     <th style="width:140px; padding:5px; background-color:#3A6A9B; color:#FFF; text-align:center; font-weight:normal;">物件種目</th>
  183.                                     <td style="padding: 5px;text-align : left; background-color:#eef; color:#000000">{{Product.syumoku}}</td>
  184.                                 </tr>
  185.                                 <tr>
  186.                                     <th style="width:140px; padding:5px; background-color:#3A6A9B; color:#FFF; text-align:center; font-weight:normal;">所在地</th>
  187.                                     <td colspan="3" style="padding: 5px;text-align : left; background-color:#eef; color:#000000;width:120px;">{{Product.pref}}{{Product.ku}}{{Product.adDetail}}</td>
  188.                                 </tr>
  189.                                 <tr>
  190.                                     <th style="; padding:5px; background-color:#3A6A9B; color:#FFF; text-align:center; font-weight:normal;">沿線・駅・交通</th>
  191.                                     <td colspan="3" style="padding: 5px;text-align : left; background-color:#eef; color:#000000;width:120px;">{{Product.ensen}}{{Product.station}}{{Product.stOther}}</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.rmNum}}{{Product.rmType}}</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 : left; background-color:#eef; color:#000000;width:120px;">{{Product.buildArea}} m<sup>2</sup></td>
  198.                                 </tr>
  199.                                 <tr>
  200.                                     <th style="width:140px; padding:5px; background-color:#3A6A9B; color:#FFF; text-align:center; font-weight:normal;">土地面積</th>
  201.                                     <td style="padding: 5px;text-align : left; background-color:#eef; color:#000000;width:120px;">{{Product.landArea}} m<sup>2</sup></td>
  202.                                     <th style="width:140px; padding:5px; background-color:#3A6A9B; color:#FFF; text-align:center; font-weight:normal;">価格</th>
  203.                                     <td style="padding: 5px;text-align : center; background-color:#eef; color:#000000;width:120px;">
  204.                                         {% if  Product.getPrice02IncTaxMax==0%}
  205.                                         <font style="color:red; font-weight:bolder;">ご成約済</font>
  206.                                         {% elseif Product.getPrice02IncTaxMax==1 %}
  207.                                         <font style="color:red; font-weight:bolder;">商 談 中</font>
  208.                                         {% else %}
  209.                                         <font style="color:red; font-weight:bolder;">{{Product.getPrice02IncTaxMax}}万円</font>
  210.                                         {% endif %}
  211.                                     </td>
  212.                                 </tr>
  213.                                 <tr style="height:40px;">
  214.                                     <td colspan="2" align="center">
  215.                                         <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');">
  216.                                             <img src="../html/user_data/assets/images/b_detail.gif" width="110" height="21" alt="詳しくはこちら" name="detail1" id="detail1" />
  217.                                          </a>
  218.                                     </td>
  219.                                     <td>
  220.                                 {#コメントアウト解除でリスト登録制御
  221.                                 {% if cartItem != null %}
  222.                                     <div class="ec-productRole__btn">
  223.                                         <button type="button" class="ec-blockBtn--cancel" disabled="disabled">
  224.                                             {{ 'リストへ追加済です'|trans }}
  225.                                         </button>
  226.                                     </div>
  227.                                 {% else %}
  228.                                     {% if Product.getPrice02IncTaxMax!=0 and Product.getPrice02IncTaxMax!=1 %}
  229.                                 ここまで#}
  230.                                         {% set form = forms[Product.id] %}
  231.                                         <form name="form{{ Product.id }}" id="productForm{{ Product.id }}" action="{{ url('product_add_cart', {id:Product.id}) }}" method="post">
  232.                                             <div class="ec-productRole__actions">
  233.                                                 {% if form.classcategory_id1 is defined %}
  234.                                                     <div class="ec-select">
  235.                                                         {{ form_widget(form.classcategory_id1) }}
  236.                                                         {{ form_errors(form.classcategory_id1) }}
  237.                                                     </div>
  238.                                                     {% if form.classcategory_id2 is defined %}
  239.                                                         <div class="ec-select">
  240.                                                             {{ form_widget(form.classcategory_id2) }}
  241.                                                             {{ form_errors(form.classcategory_id2) }}
  242.                                                         </div>
  243.                                                     {% endif %}
  244.                                                 {% endif %}
  245.                                                 <!--<div class="ec-numberInput"><span>{{ '数量'|trans }}</span>--->
  246.                                                     {{ form_widget(form.quantity, { attr :  { 'class': 'quantity' , style : 'display:none;' } }) }}
  247.                                                     {{ form_errors(form.quantity) }}
  248.                                                 <!--</div>--->
  249.                                             </div>
  250.                                             {{ form_rest(form) }}
  251.                                         </form>
  252.                                         <div class="ec-productRole__btn">
  253.                                             <a type="button" class="add-cart" data-cartid="{{ Product.id }}" form="productForm{{ Product.id }}">
  254.                                                 <img src="../../html/user_data/assets/images/b_box_in.gif" width="108" height="21" alt="カゴに入れる"style="margin:5px 0 0 0;"/>
  255.                                             </a>
  256.                                         </div>
  257.                                     {#コメントアウト解除でリスト登録制御{% elseif Product.getPrice02IncTaxMax==0 %}
  258.                                         <div class="ec-productRole__btn">
  259.                                             <button type="button" class="ec-blockBtn--cancel" disabled="disabled">
  260.                                                 {{ 'ご成約済のためリストに追加できません'|trans }}
  261.                                             </button>
  262.                                         </div>
  263.                                     {% elseif Product.getPrice02IncTaxMax==1 %}
  264.                                         <div class="ec-productRole__btn">
  265.                                             <button type="button" class="ec-blockBtn--cancel" disabled="disabled">
  266.                                                 {{ '商談中のためリストに追加できません'|trans }}
  267.                                             </button>
  268.                                         </div>
  269.                                     {% endif %}
  270.                                 ここまで#}
  271.                                     </td>
  272.                                 {#コメントアウト解除でリスト登録制御
  273.                                 {% endif %}
  274.                                 ここまで#}
  275.                                 </tr>
  276.                             </div>
  277.                                 </table>
  278.                        </div>
  279. <!--/product_cap end-->
  280.                     </div>
  281.             </div>
  282.         </li>
  283.         {% endfor %}
  284.             <div class="ec-pagerRole">
  285.                 {% include "pager.twig" with {'pages': pagination.paginationData} %}
  286.             </div>
  287. <!--/product_img end-->
  288.         </div>
  289.     </div>
  290.     {% endif %}
  291. </div>
  292. {% endif %}
  293. {% endblock %}