app/template/unishop/Product/detail.twig line 1

Open in your IDE?
  1. {#
  2. This file is part of EC-CUBE
  3. Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved.
  4. http://www.lockon.co.jp/
  5. This program is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License
  7. as published by the Free Software Foundation; either version 2
  8. of the License, or (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  16. #}
  17. {% extends 'default_frame.twig' %}
  18. {% set body_class = 'product_page' %}
  19. {% block javascript %}
  20. <script>
  21.     $('#brother').on('change', function(){
  22.         $cartbtn = $('.add-cart');
  23.         if ($cartbtn.text() != 'ただいま品切れ中です') {
  24.             if (!$(this).val()) {
  25.                 $cartbtn.prop('disabled', true);
  26.                 $cartbtn.addClass('zero');
  27.             } else {
  28.                 $cartbtn.prop('disabled', false);
  29.                 $cartbtn.removeClass('zero');
  30.             }
  31.         }
  32.     });
  33.     eccube.classCategories = {{ class_categories_as_json(Product)|raw }};
  34.     // 規格2に選択肢を割り当てる。
  35.     function fnSetClassCategories(form, classcat_id2_selected) {
  36.         var $form = $(form);
  37.         var product_id = $form.find('input[name=product_id]').val();
  38.         var $sele1 = $form.find('select[name=classcategory_id1]');
  39.         var $sele2 = $form.find('select[name=classcategory_id2]');
  40.         eccube.setClassCategories($form, product_id, $sele1, $sele2, classcat_id2_selected);
  41.     }
  42.     {% if form.classcategory_id2 is defined %}
  43.     fnSetClassCategories(
  44.         $('#form1'), {{ form.classcategory_id2.vars.value|json_encode|raw }}
  45.     );
  46.     {% elseif form.classcategory_id1 is defined %}
  47.     eccube.checkStock($('#form1'), {{ Product.id }}, {{ form.classcategory_id1.vars.value|json_encode|raw }}, null);
  48.     {% endif %}
  49.     {% if Product.product_type =='set' %}
  50.         setSetClassCategories = function($form, product_id, $sele1, $sele2, selected_id2) {
  51.             if ($sele1 && $sele1.length) {
  52.                 var classcat_id1 = $sele1.val() ? $sele1.val() : '';
  53.                 if ($sele2 && $sele2.length) {
  54.                     // 規格2の選択肢をクリア
  55.                     $sele2.children().remove();
  56.                     var classcat2;
  57.                     // 商品一覧時
  58.                     if (eccube.hasOwnProperty('productsClassCategories')) {
  59.                         classcat2 = eccube.productsClassCategories[product_id][classcat_id1];
  60.                     }
  61.                     // 詳細表示時
  62.                     else {
  63.                         classcat2 = setClassCategories[product_id][classcat_id1];
  64.                     }
  65.                     // 規格2の要素を設定
  66.                     for (var key in classcat2) {
  67.                         if (classcat2.hasOwnProperty(key)) {
  68.                             var id = classcat2[key].classcategory_id2;
  69.                             var name = classcat2[key].name;
  70.                             var option = $('<option />').val(id ? id : '').text(name);
  71.                             if (id === selected_id2) {
  72.                                 option.attr('selected', true);
  73.                             }
  74.                             $sele2.append(option);
  75.                         }
  76.                     }
  77.                     setCheckStock($form, product_id, $sele1.val() ? $sele1.val() : '__unselected2',
  78.                     $sele2.val() ? $sele2.val() : '');
  79.                 }
  80.             }
  81.         };
  82.         setCheckStock = function($form, product_id, classcat_id1, classcat_id2) {
  83.             classcat_id2 = classcat_id2 ? classcat_id2 : '';
  84.             var classcat2;
  85.             // 商品一覧時
  86.             if (eccube.hasOwnProperty('productsClassCategories')) {
  87.                 classcat2 = eccube.productsClassCategories[product_id][classcat_id1]['#' + classcat_id2];
  88.             }
  89.             // 詳細表示時
  90.             else {
  91.                 classcat2 = setClassCategories[product_id][classcat_id1]['#' + classcat_id2];
  92.             }
  93.             // 商品コード
  94.             var  $product_code = $('#item_code_default');
  95.             if (typeof this.product_code_origin === 'undefined') {
  96.                 // 初期値を保持しておく
  97.                 this.product_code_origin =  $product_code.text();
  98.             }
  99.             if (classcat2 && typeof classcat2.product_code !== 'undefined') {
  100.                 $product_code.text(classcat2.product_code);
  101.             } else {
  102.                 $product_code.text(this.product_code_origin);
  103.             }
  104.             // 在庫(品切れ)
  105.             var $cartbtn = $('#add-cart');
  106.             if (classcat2 && classcat2.stock_find === false) {
  107.                 $cartbtn.prop('disabled', true);
  108.                 $cartbtn.text('ただいま品切れ中です');
  109.             } else {
  110.                 $cartbtn.prop('disabled', false);
  111.                 $cartbtn.text('カートに入れる');
  112.             }
  113.             // 通常価格
  114.             var $price01 = $('#detail_description_box__class_normal_range_price')
  115.                 .find('.price01_default')
  116.                 .first();
  117.             if (typeof this.proce01_origin === 'undefined') {
  118.                 // 初期値を保持しておく
  119.                 this.proce01_origin = $price01.text();
  120.             }
  121.             if (classcat2 && typeof classcat2.price01 !== 'undefined' && String(classcat2.price01).length >= 1) {
  122.                 $price01.text('\ ' + classcat2.price01);
  123.             } else {
  124.                 $price01.text(this.proce01_origin);
  125.             }
  126.             // 販売価格
  127.             var $price02 = $('#detail_description_box__class_range_sale_price')
  128.                 .find('.price02_default')
  129.                 .first();
  130.             if (typeof this.proce02_origin === 'undefined') {
  131.                 // 初期値を保持しておく
  132.                 this.proce02_origin = $price02.text();
  133.             }
  134.             if (classcat2 && typeof classcat2.price02 !== 'undefined' && String(classcat2.price02).length >= 1) {
  135.                 $price02.text('\ ' + classcat2.price02);
  136.             } else {
  137.                 $price02.text(this.proce02_origin);
  138.             }
  139.             // ポイント
  140.             var $point_default = $form.find('[id^=point_default]');
  141.             var $point_dynamic = $form.find('[id^=point_dynamic]');
  142.             if (classcat2 && typeof classcat2.point !== 'undefined' && String(classcat2.point).length >= 1) {
  143.                 $point_dynamic.text(classcat2.point).show();
  144.                 $point_default.hide();
  145.             } else {
  146.                 $point_dynamic.hide();
  147.                 $point_default.show();
  148.             }
  149.             // 商品規格
  150.             var $product_class_id_dynamic = $form.find('.setproduct_item[data-product-id='+product_id+']').find('.set_product_class');
  151.             if (classcat2 && typeof classcat2.product_class_id !== 'undefined' && String(classcat2.product_class_id).length >= 1) {
  152.                 $product_class_id_dynamic.val(classcat2.product_class_id);
  153.             } else {
  154.                 $product_class_id_dynamic.val('');
  155.             }
  156.         };
  157.         $('select.setproduct_size1')
  158.         .change(function() {
  159.             var $form = $(this).parents('form');
  160.             var product_id = $(this).closest('.setproduct_item').data('product-id');
  161.             var $sele1 = $(this);
  162.             var $sele2 = $(this).closest('.setproduct_item').find('select.setproduct_size2');
  163.             var product_class_label = $('option:selected', $sele1).text();
  164.             if (product_class_label.includes("入荷予定")) {
  165.                 const str_idx = product_class_label.indexOf("入荷予定");
  166.                 const result = product_class_label.slice(str_idx);
  167.                 $sele1.closest('.setproduct_item').append('<p class="stock_date_desc red">'+result+'</p>');
  168.             } else {
  169.                 $('.stock_date_desc', $sele1.closest('.setproduct_item')).remove();
  170.             }
  171.             // 規格1のみの場合
  172.             if (!$sele2.length) {
  173.                 setCheckStock($form, product_id, $sele1.val(), null);
  174.                 // 規格2ありの場合
  175.             } else {
  176.                 setSetClassCategories($form, product_id, $sele1, $sele2);
  177.             }
  178.         });
  179.         // 規格2選択時
  180.         $('select.setproduct_size2')
  181.         .change(function() {
  182.             var $form = $(this).parents('form');
  183.             var product_id = $(this).closest('.setproduct_item').data('product-id');
  184.             var $sele1 = $(this).closest('.setproduct_item').find('select.setproduct_size1');
  185.             var $sele2 = $(this);
  186.             var product_class_label = $('option:selected', $sele2).text();
  187.             if (product_class_label.includes("入荷予定")) {
  188.                 const str_idx = product_class_label.indexOf("入荷予定");
  189.                 const result = product_class_label.slice(str_idx);
  190.                 $sele2.closest('.setproduct_item').append('<p class="stock_date_desc red">'+result+'</p>');
  191.             } else {
  192.                 $('.stock_date_desc', $sele2.closest('.setproduct_item')).remove();
  193.             }
  194.             setCheckStock($form, product_id, $sele1.val(), $sele2.val());
  195.         });
  196.         setClassCategories = [];
  197.         {% for pis in ProductInSet %}
  198.             setClassCategories[{{pis.id}}] = {{ class_categories_as_json(pis)|raw }};
  199.         {% endfor %}
  200.     {% endif %}
  201. </script>
  202. <script>
  203. $(function(){
  204.     $('.carousel').slick({
  205.         infinite: false,
  206.         speed: 300,
  207.         prevArrow:'<button type="button" class="slick-prev"><span class="angle-circle"><svg class="cb cb-angle-right"><use xlink:href="#cb-angle-right" /></svg></span></button>',
  208.         nextArrow:'<button type="button" class="slick-next"><span class="angle-circle"><svg class="cb cb-angle-right"><use xlink:href="#cb-angle-right" /></svg></span></button>',
  209.         slidesToShow: 4,
  210.         slidesToScroll: 4,
  211.         responsive: [
  212.             {
  213.                 breakpoint: 768,
  214.                 settings: {
  215.                     slidesToShow: 3,
  216.                     slidesToScroll: 3
  217.                 }
  218.             }
  219.         ]
  220.     });
  221.     $('.slides').slick({
  222.         dots: true,
  223.         arrows: false,
  224.         speed: 300,
  225.         customPaging: function(slider, i) {
  226.             return '<button class="thumbnail">' + $(slider.$slides[i]).find('img').prop('outerHTML') + '</button>';
  227.         }
  228.     });
  229.     $('#favorite').click(function() {
  230.         $('#mode').val('add_favorite');
  231.     });
  232.     // bfcache無効化
  233.     $(window).bind('pageshow', function(event) {
  234.         if (event.originalEvent.persisted) {
  235.             location.reload(true);
  236.         }
  237.     });
  238. });
  239. </script>
  240. <script>
  241.     $(function() {
  242.         $('.add-cart').on('click', function(event) {
  243.             {% if form.classcategory_id1 is defined %}
  244.             // 規格1フォームの必須チェック
  245.             if ($('#classcategory_id1').val() == '__unselected' || $('#classcategory_id1').val() == '') {
  246.                     $('#classcategory_id1')[0].setCustomValidity('{{ 'front.product.product_class_unselected'|trans }}');
  247.                 return true;
  248.             } else {
  249.                 $('#classcategory_id1')[0].setCustomValidity('');
  250.             }
  251.             {% endif %}
  252.             {% if form.classcategory_id2 is defined %}
  253.             // 規格2フォームの必須チェック
  254.             if ($('#classcategory_id2').val() == '__unselected' || $('#classcategory_id2').val() == '') {
  255.                     $('#classcategory_id2')[0].setCustomValidity('{{ 'front.product.product_class_unselected'|trans }}');
  256.                 return true;
  257.             } else {
  258.                 $('#classcategory_id2')[0].setCustomValidity('');
  259.             }
  260.             {% endif %}
  261.             var isAllCategorySelected = true;
  262.             $('.setproduct_item select').each(function(idx){
  263.                 if($(this).val() == '__unselected' || $(this).val() == ''){
  264.                     this.setCustomValidity('{{ '項目が選択されていません'|trans }}');
  265.                     isAllCategorySelected = false;
  266.                     return true;
  267.                 }
  268.                 else
  269.                     this.setCustomValidity('');
  270.             });
  271.             if(!isAllCategorySelected)
  272.                 return true;
  273.             // 個数フォームのチェック
  274.             if ($('#quantity').val() < 1) {
  275.                     $('#classcategory_id2')[0].setCustomValidity('{{ 'front.product.product_class_unselected'|trans }}');
  276.                 return true;
  277.             } else {
  278.                 $('#quantity')[0].setCustomValidity('');
  279.             }
  280.             event.preventDefault();
  281.             $form = $('#form1');
  282.             $.ajax({
  283.                 url: $form.attr('action'),
  284.                 type: $form.attr('method'),
  285.                 data: $form.serialize(),
  286.                 dataType: 'json',
  287.                 beforeSend: function(xhr, settings) {
  288.                     // Buttonを無効にする
  289.                     $('.add-cart').prop('disabled', true);
  290.                 }
  291.             }).done(function(data) {
  292.                 // レスポンス内のメッセージをalertで表示
  293.                 $.each(data.messages, function() {
  294.                         $('#ec-modal-header').text(this);
  295.                 });
  296.                 $('.ec-modal').show()
  297.                 // カートブロックを更新する
  298.                 $.ajax({
  299.                     url: "{{ url('block_cart') }}",
  300.                     type: 'GET',
  301.                     dataType: 'html'
  302.                 }).done(function(html) {
  303.                     $('.ec-headerRole__cart').html(html);
  304.                 });
  305.             }).fail(function(data) {
  306.                     alert('{{ 'front.product.add_cart_error'|trans }}');
  307.             }).always(function(data) {
  308.                 // Buttonを有効にする
  309.                 $('.add-cart').prop('disabled', false);
  310.             });
  311.         });
  312.     });
  313.     $('.ec-modal-wrap').on('click', function(e) {
  314.         // モーダル内の処理は外側にバブリングさせない
  315.         e.stopPropagation();
  316.     });
  317.     $('.ec-modal-overlay, .ec-modal, .ec-modal-close, .ec-inlineBtn--cancel').on('click', function() {
  318.         $('.ec-modal').hide()
  319.     });
  320.     $('#add_favorite').click(function(){
  321.         $('#add_favorite_form').submit();
  322.     });
  323. </script>
  324. <script type="application/ld+json">
  325. {
  326.     "@context": "https://schema.org/",
  327.     "@type": "Product",
  328.     "name": "{{ Product.name }}",
  329.     "image": [
  330.         {% for img in Product.ProductImage %}
  331.             "{{ app.request.schemeAndHttpHost }}{{ asset(img, 'save_image') }}"{% if not loop.last %},{% endif %}
  332.         {% else %}
  333.             "{{ app.request.schemeAndHttpHost }}{{ asset(''|no_image_product, 'save_image') }}"
  334.         {% endfor %}
  335.     ],
  336.     "description": "{{ Product.description_list | default(Product.description_detail) | replace({'\n': '', '\r': ''}) | slice(0,300) }}",
  337.     {% if Product.code_min %}
  338.     "sku": "{{ Product.code_min }}",
  339.     {% endif %}
  340.     "offers": {
  341.         "@type": "Offer",
  342.         "url": "{{ url('product_detail', {'id': Product.id}) }}",
  343.         "priceCurrency": "{{ eccube_config.currency }}",
  344.         "price": {{ Product.getPrice02IncTaxMin }},
  345.         "availability": "{{ Product.stock_find ? "InStock" : "OutOfStock" }}"
  346.     }
  347. }
  348. {% endblock %}
  349. {% block stylesheet %}
  350.     <style>
  351.         .setproduct_size select{
  352.             margin-bottom: 15px;
  353.         }
  354.         .discount_price
  355.         {
  356.             font-size: 25px;
  357.             font-weight: bold;
  358.         }
  359.         .discount_period {
  360.             font-size: 18px;
  361.             margin-top: 10px !important;
  362.             font-weight: bold;
  363.         }
  364.     </style>
  365. {% endblock %}
  366. {% block main %}
  367.     {% include 'rireki_hikaku.twig' %}
  368.     <!-- ▼item_detail▼ -->
  369.     <div id="item_detail">
  370.         <div id="detail_wrap" class="row">
  371.         {% if is_granted('ROLE_USER') %}
  372.             <!--★画像★-->
  373.             <div id="item_photo_area" class="col-sm-6">
  374.                 <div id="detail_image_box__slides" class="slides">
  375.                     {% if Product.ProductImage|length > 0 %}
  376.                         {% for ProductImage in Product.ProductImage %}
  377.                             <div id="detail_image_box__item--{{ loop.index }}">
  378.                                 <img src="{{ asset(ProductImage|no_image_product , 'save_image') }}"/>
  379.                             </div>
  380.                         {% endfor %}
  381.                     {% else %}
  382.                         <div id="detail_image_box__item"><img src="{{ asset(''|no_image_product, 'save_image') }}"/></div>
  383.                     {% endif %}
  384.                 </div>
  385.             </div>
  386.             <section id="item_detail_area" class="col-sm-6">
  387.                 {% if Product.ProductTag is not empty %}
  388.                     <!--▼商品タグ-->
  389.                     <div id="product_tag_box" class="product_tag">
  390.                         {% include 'Block/product_sex_tag.twig' %}
  391.                         {% if Product.hasTag('購入必需品') %}
  392.                             <div class="cateicon2">入学時の必要品</div>
  393.                         {% elseif Product.hasTag('購入必需品(選択可)') %}
  394.                             <div class="cateicon2">入学時の必要品(選択可)</div>
  395.                         {% elseif Product.hasTag('希望購入品') %}
  396.                             <div class="cateicon3">希望購入品</div>
  397.                             {% elseif Product.hasTag('購入必需品(女子も購入可)') %}
  398.                             <div class="cateicon2">入学時の必要品(女子も購入可)</div>
  399.                         {% endif %}
  400.                     </div>
  401.                 {% endif %}
  402.                 <!--★商品名★-->
  403.                 <h3 id="detail_description_box__name" class="item_name">{{ Product.name }}</h3>
  404.                 <div id="detail_description_box__body" class="item_detail">
  405.                     <!--★通常価格★-->
  406.                     {% if Product.hasProductClass -%}
  407.                         {% if Product.getPrice01Min is not null and Product.getPrice01IncTaxMin == Product.getPrice01IncTaxMax %}
  408.                             <p id="detail_description_box__class_normal_price" class="normal_price">
  409.                                 <span class="ec-productRole__priceRegularPrice">{{ 'front.product.normal_price'|trans }}:<span class="price01-default">{{ Product.getPrice01IncTaxMin|price }}</span></span>
  410.                                 <span class="ec-productRole__priceRegularTax">{{ 'common.tax_include'|trans }}</span>
  411.                             </p>
  412.                         {% elseif Product.getPrice01Min is not null and Product.getPrice01Max is not null %}
  413.                             <p id="detail_description_box__class_normal_price" class="normal_price">
  414.                                 <span class="ec-productRole__priceRegularPrice">{{ 'front.product.normal_price'|trans }}:<span class="price01-default">{{ Product.getPrice01IncTaxMin|price }}</span></span>
  415.                                 <span class="ec-productRole__priceRegularTax">{{ 'common.tax_include'|trans }}</span>
  416.                             </p>
  417.                         {% endif %}
  418.                     {% else -%}
  419.                         {% if Product.getPrice01Max is not null %}
  420.                             <p id="detail_description_box__normal_price" class="normal_price"> 通常価格:<span class="price01_default">{{ Product.getPrice01IncTaxMin|price }}</span> <span class="small">税込</span></p>
  421.                         {% endif %}
  422.                     {% endif -%}
  423.                     <!--★販売価格★-->
  424.                     {% if Product.hasProductClass -%}
  425.                         {% if Product.getPrice02IncTaxMin == Product.getPrice02IncTaxMax %}
  426.                             <p id="detail_description_box__class_sale_price" class="sale_price text-primary">
  427.                                 <span class="ec-price__price price02-default">{{ Product.getPrice02IncTaxMin|price }}</span>
  428.                                 <span class="ec-price__tax">{{ 'common.tax_include'|trans }}</span>
  429.                             </p>
  430.                         {% else %}
  431.                             <p id="detail_description_box__class_range_sale_price" class="sale_price text-primary">
  432.                                 <span class="ec-price__price price02-default">{{ Product.getPrice02IncTaxMin|price }} ~ {{ Product.getPrice02IncTaxMax|price }}</span>
  433.                                 <span class="ec-price__tax">{{ 'common.tax_include'|trans }}</span>
  434.                             </p>
  435.                         {% endif %}
  436.                     {% else -%}
  437.                         <p id="detail_description_box__sale_price" class="sale_price text-primary">
  438.                             <span class="ec-price__price">{{ Product.getPrice02IncTaxMin|price }}</span>
  439.                             <span class="ec-price__tax">{{ 'common.tax_include'|trans }}</span>
  440.                         </p>
  441.                     {% endif -%}
  442.                     <!--★割引価格★-->
  443.                     {% if app.user.school.sale_start_date<date() and app.user.school.sale_end_date>date() and Product.getPrice03IncTaxMin%}
  444.                         {% if Product.hasProductClass -%}
  445.                             {% if Product.getPrice03IncTaxMin == Product.getPrice03IncTaxMax %}
  446.                                 <p id="detail_description_box__class_discount_price" class="discount_price text-primary">
  447.                                     <span>割引価格:</span><span class="price03_default">{{ Product.getPrice03IncTaxMin|price }}</span> <span class="small">税込</span>
  448.                                 </p>
  449.                             {% else %}
  450.                                 <p id="detail_description_box__class_range_discount_price" class="discount_price text-primary"><span class="price03_default">{{ Product.getPrice03IncTaxMin|price }} ~ {{ Product.getPrice02IncTaxMax|price }}</span> <span class="small">税込</span></p>
  451.                             {% endif %}
  452.                         {% else -%}
  453.                             <p id="detail_description_box__discount_price" class="sale_price text-primary discount_price"><span class="price03_default">{{ Product.getPrice03IncTaxMin|price }}</span> <span class="small">税込</span></p>
  454.                         {% endif -%}
  455.                         <p class="discount_period text-primary">割引期間:{{ app.user.school.sale_start_date|date('Y年m月d日') }} ~ {{ app.user.school.sale_end_date|date('Y年m月d日') }}</p>
  456.                     {% endif %}
  457.                     <form action="{{ url('product_add_cart', {id:Product.id}) }}" method="post" id="form1" name="form1">
  458.                         <!--▼買い物かご-->
  459.                         <div id="detail_cart_box" class="cart_area">
  460.                             {% if Product.stock_find %}
  461.                                 {# 規格 #}
  462.                                 {% if form.classcategory_id1 is defined or Product.product_type=='set'%}
  463.                                     <ul id="detail_cart_box__cart_class_category_id" class="classcategory_list">
  464.                                         {% if Product.product_type != 'set' %}
  465.                                             {% if app.user.school.size_recommend_flag %}
  466.                                                 {% if RecommendSize is defined and RecommendSize %}
  467.                                                     <li class="rec_size">
  468.                                                          <p>自分のサイズ:{{ Place[RecommendSize.RecommendX.recommend_xplace] }}…{{ x }}/{{ Place[RecommendSize.RecommendY.recommend_yplace] }}…{{ y }}</p>
  469.                                                          <p class="result">貴方へのオススメサイズは<br><span>{{ RecommendSize.recommend_notation }}</span>です</p>
  470.                                                          <p class="kome">こちらはサイズをオススメさせて頂く機能となります。<br>サイズ、数量のご入力はお客様ご自身で行ってください。</p>
  471.                                                     </li>
  472.                                                 {% elseif Product.Recommend is not null %}
  473.                                                     <li>「採寸データが正しく登録されていないため、サイズのオススメができません。<br/>
  474.                                                         <span><a href="{{ url('mypage_change_saisun') }}" target="_blank">オススメサイズが知りたい</a></span>
  475.                                                     </li>
  476.                                                 {% endif %}
  477.                                             {% endif %}
  478.                                         {% endif %}
  479.                                         {# 規格1 #}
  480.                                         {% if Product.product_type != 'set' %}
  481.                                             <li>
  482.                                             {% set break = false %}
  483.                                             {% if form.classcategory_id1 is defined %}
  484.                                                 {{ form_widget(form.classcategory_id1) }}
  485.                                                 {{ form_errors(form.classcategory_id1) }}
  486.                                             {% endif %}
  487.                                             </li>
  488.                                             {# 規格2 #}
  489.                                             {% if form.classcategory_id2 is defined %}
  490.                                                 <li>
  491.                                                     {{ form_widget(form.classcategory_id2) }}
  492.                                                     {{ form_errors(form.classcategory_id2) }}
  493.                                                 </li>
  494.                                             {% endif %}
  495.                                         {% else %}
  496.                                             <li class="setproduct_size">
  497.                                             {% for pis in ProductInSet %}
  498.                                                 <div class="setproduct_item" data-product-id="{{ pis.id }}">
  499.                                                     <p>{{ pis.name }}</p>
  500.                                                     {% set category2_count = 0 %}
  501.                                                     {% set class_category1 = [] %}
  502.                                                     {% if pis.getProductClasses|length > 1 %}
  503.                                                         <select class="form-control setproduct_size1" required>
  504.                                                             <option value="__unselected">{{'common.select'|trans}}</option>
  505.                                                             {% for ps in pis.getProductClasses %}
  506.                                                                 {% if ps.ClassCategory1 is not null and ps.visible and ps.ClassCategory1.id not in class_category1 %}
  507.                                                                 <option value="{{ps.ClassCategory1.id}}">{{ps.ClassCategory1.name}}</option>
  508.                                                                 {% set class_category1 = class_category1|merge({ (loop.index0): ps.ClassCategory1.id }) %}
  509.                                                                 {% endif %}
  510.                                                                 {% if ps.ClassCategory2 is not null%}
  511.                                                                 {% set category2_count = category2_count + 1 %}
  512.                                                                 {% endif %}
  513.                                                             {% endfor %}
  514.                                                         </select>
  515.                                                     {% endif %}
  516.                                                     {% if category2_count != 0 %}
  517.                                                     {# 規格2 #}
  518.                                                     <select class="form-control setproduct_size2" required>
  519.                                                         <option value="__unselected">{{'common.select'|trans}}</option>
  520.                                                     </select>
  521.                                                     {% endif %}
  522.                                                     <input type="hidden" name="SetProductClass[]" class="set_product_class {{ pis.getProductClasses|length == 1 ? 'no_product_class' : ''}}" value="{{ pis.getProductClasses|length == 1 ? pis.getProductClasses[0].id : ''}}">
  523.                                                 </div>
  524.                                             {% endfor %}
  525.                                             </li>
  526.                                         {% endif %}
  527.                                     </ul>
  528.                                 {% endif %}
  529.                                 {# 数量 #}
  530.                                 <dl id="detail_cart_box__cart_quantity" class="quantity">
  531.                                     <dt>数量</dt>
  532.                                     <dd>
  533.                                         {{ form_widget(form.quantity) }}
  534.                                         {{ form_errors(form.quantity) }}
  535.                                         {% if app.user.school.isBrotherEnabled %}
  536.                                             {{ form_widget(form.brother) }}
  537.                                             {{ form_errors(form.brother) }}
  538.                                         {% endif %}
  539.                                     </dd>
  540.                                 </dl>
  541.                                 <div class="extra-form">
  542.                                     {% for f in form.getIterator %}
  543.                                         {% if f.vars.name matches '[^plg*]' %}
  544.                                             {{ form_row(f) }}
  545.                                         {% endif %}
  546.                                     {% endfor %}
  547.                                 </div>
  548.                                 {# カートボタン #}
  549.                                 <div id="detail_cart_box__button_area" class="btn_area">
  550.                                     <ul id="detail_cart_box__insert_button" class="row">
  551.                                         <li class="col-xs-12 col-sm-8">
  552.                                             <button type="submit" class="ec-blockBtn--action def_button4 add-cart{% if app.user.school.isBrotherEnabled %} zero{% endif %}"{% if app.user.school.isBrotherEnabled %} disabled="disabled"{% endif %}>{{ 'front.product.add_cart'|trans }}</button>
  553.                                         </li>
  554.                                     </ul>
  555.                                 </div> {# End div#detail_cart_box__button_area #}
  556.                             {% else %}
  557.                                 {# 在庫がない場合は品切れボタンを表示 #}
  558.                                 <div id="detail_cart_box__button_area" class="btn_area">
  559.                                     <ul class="row">
  560.                                         <li class="col-xs-12 col-sm-8">
  561.                                             <button type="button" class="ec-blockBtn--action def_button4 zero" disabled="disabled">{{ 'front.product.out_of_stock'|trans }}</button>
  562.                                             {% if Product.product_classes[0].stock_date %}
  563.                                             <p>{{ Product.product_classes[0].stock_date|date('Y年m月d日') }}入荷予定</p>
  564.                                             {% endif %}
  565.                                         </li>
  566.                                     </ul>
  567.                                 </div> {# End div#detail_cart_box__button_area #}
  568.                             {% endif %} {# End stock find #}
  569.                         </div>
  570.                         <!--▲買い物かご-->
  571.                         {{ form_rest(form) }}
  572.                     </form>
  573.                     {% if BaseInfo.option_favorite_product %}
  574.                         <form action="{{ url('product_add_favorite', {id:Product.id}) }}" method="post" id="add_favorite_form">
  575.                             <div class="btn_area">
  576.                                 <ul id="detail_cart_box__favorite_button" class="row">
  577.                                     {% if is_favorite == false %}
  578.                                         <li class="col-xs-12 col-sm-8">
  579.                                             <button type="submit" id="favorite" class="ec-blockBtn--cancel def_button5">{{ 'front.product.add_favorite'|trans }}</button>
  580.                                         </li>
  581.                                     {% else %}
  582.                                         <li class="col-xs-12 col-sm-8">
  583.                                             <button type="submit" id="favorite" class="ec-blockBtn--cancel def_button5 ck" disabled="disabled">{{ 'front.product.add_favorite_alrady'|trans }}</button>
  584.                                         </li>
  585.                                     {% endif %}
  586.                                 </ul>
  587.                             </div>
  588.                         </form>
  589.                     {% endif %}
  590.                 </div>
  591.                 <!-- /.item_detail -->
  592.             </section>
  593.             <!--詳細ここまで-->
  594.         {% endif %}
  595.         </div>
  596.         {# フリーエリア #}
  597.         {% if Product.freearea %}
  598.             <div id="sub_area" class="row">
  599.                 <div class="col-sm-10 col-sm-offset-1">
  600.                     <div id="detail_free_box__freearea" class="freearea">{{ include(template_from_string(Product.freearea)) }}</div>
  601.                 </div>
  602.             </div>
  603.         {% endif %}
  604.     </div>
  605.     <!-- ▲item_detail▲ -->
  606. {% endblock %}