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

Open in your IDE?
  1. {#
  2. * Plugin Name : ProductOption
  3. *
  4. * Copyright (C) BraTech Co., Ltd. All Rights Reserved.
  5. * http://www.bratech.co.jp/
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. #}
  10. {% set prev_condition = '' %}
  11. {% set count = 0 %}
  12. {% set index = 0 %}
  13. {% for ProductOption in ProductOptions %}
  14.     {% set Option = ProductOption.Option %}
  15.     {% set Product = ProductOption.Product %}
  16.         {% set value = 'productoption' ~ ProductOption.Option.id %}
  17.         {% set current_condition = '' %}
  18.         {% if '張地' in ProductOption.Option.backend_name %}
  19.             {% set current_condition = '張地' %}
  20.         {% elseif 'サイズ選択' in ProductOption.Option.backend_name %}
  21.             {% set current_condition = 'サイズ' %}
  22.         {% elseif '画像あり' in ProductOption.Option.backend_name %}
  23.             {% set current_condition = '画像あり' %}
  24.         {% elseif '配送' in ProductOption.Option.backend_name %}
  25.             {% set current_condition = '配送' %}
  26.         {% else %}
  27.             {# 他の条件を追加する場合は、ここに追加してください。 #}
  28.         {% endif %}
  29.         {% if (prev_condition != current_condition and current_condition == '張地') or (prev_condition != current_condition and current_condition == 'サイズ') %}
  30.             {# 最後のカウントの処理 ============================= #}
  31.             {% if prev_condition != '' %}
  32.             {% endif %}
  33.             {# 最初のカウントの処理 ============================= #}
  34.             {% set count = 0 %}
  35.             {% if count == 0 %}
  36.                 <div id="option_description_{{ current_condition }}" class="option_description">
  37.                     <div class="modal-header">
  38.                         <div class="plainmodal-close">&#215;</div>
  39.                         <h4 class="modal-title">{{ current_condition }}選択</h4>
  40.                     </div>
  41.                     <div class="modal-body">
  42.                         {% for ProductOption in Product.ProductOptions %}
  43.                             {% set value = 'productoption' ~ ProductOption.Option.id %}
  44.                             {% if current_condition in ProductOption.Option.backend_name %}
  45.                                 <div class="option_Label">
  46.                                     {{ form_label(form[value]) }}{% if form[value].vars.required %}<span class="ec-required">{{'common.required'|trans}}</span>{% endif %}
  47.                                     <p>{{ ProductOption.Option.description|raw|nl2br }}</p>
  48.                                 </div>
  49.                                 <div class="opcion_first_flex">
  50.                                 {% for optionCategory in ProductOption.option.OptionCategories %}
  51.                                     {% if optionCategory.disable_flg != constant('Plugin\\ProductOption42\\Entity\\OptionCategory::ON') %}
  52.                                         <div class="opcion_first_flex__block">
  53.                                             {% for OptionImage in optionCategory.OptionImages %}
  54.                                                 <img src="{{ asset(OptionImage, 'save_image') }}"/>
  55.                                             {% endfor %}
  56.                                             <span class="option_txt">{{ optionCategory.name }}</span>
  57.                                         </div>
  58.                                     {% endif %}
  59.                                 {% endfor %}
  60.                                 </div>
  61.                                 {% if ProductOption.Option.description_flg == constant('Plugin\\ProductOption42\\Entity\\Option::DISP_ON') %}
  62.                                     &nbsp;<a href="?" id="option_description_link_{{ Product.id }}_{{ ProductOption.Option.id }}" data="{{ Product.id }}" class="option_description_link_second"><span class="ec-link ec-font-size-2">{{ form_label(form[value]) }}から選択する</span></a>
  63.                                 {% endif %}
  64.                             {% endif %}
  65.                         {% endfor %}
  66.                     </div>
  67.                 </div>
  68.             {% endif %}
  69.         {% endif %}
  70.         {# 最初と最後以外の通常処理 ============================= #}
  71.         <div id="option_description_{{ Product.id }}_{{ Option.id }}" class="option_description option_description__detail">
  72.             <div class="modal-header">
  73.                 <div class="plainmodal-close">&#215;</div>
  74.                 <h4 class="modal-title">{{ Option.name }}</h4>
  75.                 <p>{{ Option.description|raw|nl2br }}</p>
  76.                 {% if current_condition == '張地' or current_condition == 'サイズ' %}
  77.                 <a href="?" id="option_back_link_{{ current_condition }}" class="option_back_btn" data="{{ Product.id }}">
  78.                     <span class="ec-link ec-font-size-2">< 一覧に戻る</span>
  79.                 </a>
  80.                 {% endif %}
  81.             </div>
  82.             {% if Option.OptionCategories|length > 0%}
  83.                 {# テキストボックス、テキストエリア、日付、数値入力タイプの場合 #}
  84.                 {% if Option.type == constant('Plugin\\ProductOption42\\Entity\\Option::TEXT_TYPE') or Option.type == constant('Plugin\\ProductOption42\\Entity\\Option::TEXTAREA_TYPE') or Option.type == constant('Plugin\\ProductOption42\\Entity\\Option::NUMBER_TYPE') or Option.type == constant('Plugin\\ProductOption42\\Entity\\Option::DATE_TYPE') %}
  85.                     <div class="modal-body">
  86.                         {% set optionCategory = Option.OptionCategories[0] %}
  87.                         <div>
  88.                             {% for OptionImage in optionCategory.OptionImages %}
  89.                                 <img src="{{ asset(OptionImage, 'save_image') }}"/>
  90.                             {% endfor %}
  91.                             {% if optionCategory.value|length > 0  %}
  92.                                 {% if optionCategory.value > 0  %}
  93.                                     <p class="plus">{{'productoption.product.option.description.price'|trans}}:{{ priceIncTax(optionCategory.value, Product)|price }} <span class="small">{{'productoption.product.option.description.inc_tax'|trans}}</span></p>
  94.                                 {% elseif optionCategory.value < 0 %}
  95.                                     <p class="minus">{{'productoption.product.option.description.price'|trans}}:{{ priceIncTax(optionCategory.value, Product)|price }} <span class="small">{{'productoption.product.option.description.inc_tax'|trans}}</span></p>
  96.                                 {% endif %}
  97.                             {% endif %}
  98.                             {% if optionCategory.delivery_free_flg == constant('Plugin\\ProductOption42\\Entity\\OptionCategory::ON') %}
  99.                                 <p>{{'productoption.common.delivery_free'|trans}}</p>
  100.                             {% endif %}
  101.                         </div>
  102.                     </div>
  103.                     {# プルダウン、ラジオボタン、チェックボックスタイプの場合 #}
  104.                 {% else %}
  105.                     <div class="modal-body">
  106.                         {% for optionCategory in Option.OptionCategories %}
  107.                             {% if optionCategory.disable_flg != constant('Plugin\\ProductOption42\\Entity\\OptionCategory::ON') %}
  108.                                 <div>
  109.                                     <h3>{{ optionCategory.name }}</h3>
  110.                                     {% for OptionImage in optionCategory.OptionImages %}
  111.                                         <img src="{{ asset(OptionImage, 'save_image') }}"/>
  112.                                     {% endfor %}
  113.                                     <p>{{ optionCategory.description|raw|nl2br }}</p>
  114.                                     {% if optionCategory.value|length > 0  %}
  115.                                         {% if optionCategory.value > 0  %}
  116.                                             {#<p class="plus">{{'productoption.product.option.description.price'|trans}}:{{ priceIncTax(optionCategory.value, Product)|price }} <span class="small">{{'productoption.product.option.description.inc_tax'|trans}}</span></p>#}
  117.                                         {% elseif optionCategory.value < 0 %}
  118.                                             <p class="minus">{{'productoption.product.option.description.price'|trans}}:{{ priceIncTax(optionCategory.value, Product)|price }} <span class="small">{{'productoption.product.option.description.inc_tax'|trans}}</span></p>
  119.                                         {% endif %}
  120.                                     {% endif %}
  121.                                     {% if optionCategory.delivery_free_flg == constant('Plugin\\ProductOption42\\Entity\\OptionCategory::ON') %}
  122.                                         <p>{{'productoption.common.delivery_free'|trans}}</p>
  123.                                     {% endif %}
  124.                                     <button class="btn-info" id="desc_btn_{{ Option.id }}_{{ optionCategory.id }}" data-type="{{ current_condition }}" >{{'productoption.product.option.description.select'|trans}}</button>
  125.                                 </div>
  126.                             {% endif %}
  127.                         {% endfor %}
  128.                     </div>
  129.                 {% endif %}
  130.             {% endif %}
  131.         </div>
  132.         {% set prev_condition = current_condition %}
  133.         {% set count = count + 1 %}
  134.         {% set index = index + 1 %}
  135.     {% endfor %}