app/template/default/Product/option.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. {% if Product.ProductOptions %}
  11.         {% for ProductOption in Product.ProductOptions %}
  12.             {% set value = 'productoption' ~ ProductOption.Option.id %}
  13.             {# ラジオボタン #}
  14.             {% if ProductOption.Option.type == constant('Plugin\\ProductOption42\\Entity\\Option::RADIO_TYPE') %}
  15.                 <tr class="ec-blockRadio">
  16.                     <th class="option_Label">
  17.                         <label for="productoption{{ ProductOption.Option.id }}">{{ form[value].vars.label }}</label>
  18.                         {# {{ ProductOption.Option.name }} #}
  19.                     </th>
  20.                     <td>
  21.                         {% if ProductOption.Option.description_flg == constant('Plugin\\ProductOption42\\Entity\\Option::DISP_ON') %}
  22.                             {# &nbsp;<a href="?" id="option_description_link_{{ Product.id }}_{{ ProductOption.Option.id }}" data="{{ Product.id }}"><span class="ec-link ec-font-size-2">{{'productoption.product.option.description.title'|trans}}</span></a> #}
  23.                             <p class="mod-form-description">{{ ProductOption.Option.description }}</p>
  24.                         {% endif %}                    
  25.                         {# {{ form_widget(form[value]) }} #}
  26.                         <div id="{{ value }}">
  27.                         {% for key, child in form[value] %}
  28.                             <div style="display: block;">
  29.                             {% set OptionCategory = form[value].vars.choices[key].data %}
  30.                             {{ form_widget(child) }}
  31.                                 {% if OptionCategory.OptionImages is not null %}
  32.                                     {% for OptionImage in OptionCategory.OptionImages %}
  33.                                         <div class="option-img"><img src="{{ asset(OptionImage.file_name, 'save_image') }}" class="imgFit"></div>
  34.                                     {% endfor %}
  35.                                 {% endif %}
  36.                             </div>
  37.                         {% endfor %}
  38.                         </div>                        
  39.                     </td>
  40.                 </tr>
  41.             {# チェックボックス #}
  42.             {% elseif ProductOption.Option.type == constant('Plugin\\ProductOption42\\Entity\\Option::CHECKBOX_TYPE')%}
  43.                 <tr class="ec-checkbox">
  44.                     <th class="option_Label">
  45.                         <label for="productoption{{ ProductOption.Option.id }}">{{ form[value].vars.label }}</label>
  46.                         {# {{ ProductOption.Option.name }} #}
  47.                     </th>
  48.                     <td>
  49.                         {% if ProductOption.Option.description_flg == constant('Plugin\\ProductOption42\\Entity\\Option::DISP_ON') %}
  50.                         {# &nbsp;<a href="?" id="option_description_link_{{ Product.id }}_{{ ProductOption.Option.id }}" data="{{ Product.id }}"><span class="ec-link ec-font-size-2">{{'productoption.product.option.description.title'|trans}}</span></a> #}
  51.                         <p class="mod-form-description">{{ ProductOption.Option.description }}</p>
  52.                         {% endif %}                        
  53.                         {{ form_widget(form[value]) }}
  54.                     </td>
  55.                 </tr>
  56.             {# プルダウンタイプ #}
  57.             {% elseif  ProductOption.Option.type == constant('Plugin\\ProductOption42\\Entity\\Option::SELECT_TYPE')%}
  58.                 <tr class="ec-select">
  59.                     <th class="option_Label">
  60.                         {{ form_label(form[value]) }}
  61.                         {{ ProductOption.Option.name }}
  62.                     </th>
  63.                     <td {% if form[value].vars.errors is not empty %}class="has-error"{% endif %}>
  64.                         {% if ProductOption.Option.description_flg == constant('Plugin\\ProductOption42\\Entity\\Option::DISP_ON') %}
  65.                             {# &nbsp;<a href="?" id="option_description_link_{{ Product.id }}_{{ ProductOption.Option.id }}" data="{{ Product.id }}"><span class="ec-link ec-font-size-2">{{'productoption.product.option.description.title'|trans}}</span></a> #}
  66.                             <p class="mod-form-description">{{ ProductOption.Option.description }}</p>
  67.                         {% endif %}                    
  68.                         {{ form_widget(form[value], {'attr': {'class': 'mod-form-select'}}) }}
  69.                     {{ form_errors(form[value]) }}
  70.                     </td>
  71.                 </tr>
  72.             {# 数値入力タイプ #}
  73.             {% elseif ProductOption.Option.type == constant('Plugin\\ProductOption42\\Entity\\Option::NUMBER_TYPE') %}
  74.                 <tr class="ec-numberInput">
  75.                     <th class="option_Label">
  76.                     {{ form_label(form[value]) }}
  77.                     {{ ProductOption.Option.name }}
  78.                     </th>
  79.                     <td {% if form[value].vars.errors is not empty %}class="has-error"{% endif %}>
  80.                         {% if ProductOption.Option.description_flg == constant('Plugin\\ProductOption42\\Entity\\Option::DISP_ON') %}
  81.                             {# &nbsp;<a href="?" id="option_description_link_{{ Product.id }}_{{ ProductOption.Option.id }}" data="{{ Product.id }}"><span class="ec-link ec-font-size-2">{{'productoption.product.option.description.title'|trans}}</span></a> #}
  82.                             <p class="mod-form-description">{{ ProductOption.Option.description }}</p>
  83.                         {% endif %}                    
  84.                         {{ form_widget(form[value], {'attr': {'class': 'mod-form-input-text'}}) }}
  85.                     {{ form_errors(form[value]) }}
  86.                     </td>
  87.                 </tr>
  88.             {# 日付タイプ #}
  89.             {% elseif ProductOption.Option.type == constant('Plugin\\ProductOption42\\Entity\\Option::DATE_TYPE') %}
  90.                 <tr class="ec-input">
  91.                     <th class="option_Label">
  92.                     {{ form_label(form[value]) }}
  93.                     {{ ProductOption.Option.name }}
  94.                     </th>
  95.                     <td {% if form[value].vars.errors is not empty %}class="has-error"{% endif %} style="position: relative">
  96.                         {% if ProductOption.Option.description_flg == constant('Plugin\\ProductOption42\\Entity\\Option::DISP_ON') %}
  97.                             {# &nbsp;<a href="?" id="option_description_link_{{ Product.id }}_{{ ProductOption.Option.id }}" data="{{ Product.id }}"><span class="ec-link ec-font-size-2">{{'productoption.product.option.description.title'|trans}}</span></a> #}
  98.                             <p class="mod-form-description">{{ ProductOption.Option.description }}</p>
  99.                         {% endif %}                    
  100.                         {{ form_widget(form[value], { attr : { 'data-target' : '#'~form[value].vars.id, 'class': 'mod-form-input-text' }}) }}
  101.                     {{ form_errors(form[value]) }}
  102.                     </div>
  103.                 </div>
  104.             {# テキストボックスタイプ #}
  105.             {% elseif ProductOption.Option.type == constant('Plugin\\ProductOption42\\Entity\\Option::TEXT_TYPE') %}
  106.             {# {{ dump(ProductOption.option) }} #}
  107.                 <tr class="ec-input">
  108.                     <th class="option_Label">
  109.                     {{ form_label(form[value]) }}
  110.                     {{ ProductOption.Option.name }}
  111.                     </th>
  112.                     <td {% if form[value].vars.errors is not empty %}class="has-error"{% endif %}>
  113.                         {% if ProductOption.Option.description_flg == constant('Plugin\\ProductOption42\\Entity\\Option::DISP_ON') %}
  114.                             {# &nbsp;<a href="?" id="option_description_link_{{ Product.id }}_{{ ProductOption.Option.id }}" data="{{ Product.id }}"><span class="ec-link ec-font-size-2">{{'productoption.product.option.description.title'|trans}}</span></a> #}
  115.                             <p class="mod-form-description">{{ ProductOption.Option.description }}</p>
  116.                         {% endif %}                    
  117.                         {{ form_widget(form[value], {'attr': {'class': 'mod-form-input-text'}}) }}
  118.                     {{ form_errors(form[value]) }}
  119.                     </td>
  120.                 </tr>
  121.             {# テキストエリアタイプ #}
  122.             {% elseif ProductOption.Option.type == constant('Plugin\\ProductOption42\\Entity\\Option::TEXTAREA_TYPE')%}
  123.                 <tr class="ec-input">
  124.                     <th class="option_Label">
  125.                         {{ form_label(form[value]) }}
  126.                         {{ ProductOption.Option.name }}
  127.                     </th>
  128.                     <td {% if form[value].vars.errors is not empty %}class="has-error"{% endif %}>
  129.                         {% if ProductOption.Option.description_flg == constant('Plugin\\ProductOption42\\Entity\\Option::DISP_ON') %}
  130.                             {# &nbsp;<a href="?" id="option_description_link_{{ Product.id }}_{{ ProductOption.Option.id }}" data="{{ Product.id }}"><span class="ec-link ec-font-size-2">{{'productoption.product.option.description.title'|trans}}</span></a> #}
  131.                             <p class="mod-form-description">{{ ProductOption.Option.description }}</p>
  132.                         {% endif %}                    
  133.                         {{ form_widget(form[value], {'attr': {'class': 'mod-form-input-textArea'}}) }}
  134.                     {{ form_errors(form[value]) }}
  135.                     </td>
  136.                 </tr>
  137.             {% endif %}
  138.         {% endfor %}
  139. {% endif %}