app/template/HF4002/Block/search_product.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. {% form_theme form 'Form/form_div_layout.twig' %}
  9. {% set start_date = '2021-09-06'|date('Y-m-d') %}
  10. {% set end_date = '2021-09-27'|date('Y-m-d') %}
  11. {% set sale_category_id = "174" %}
  12. {% if start_date <= date()|date('Y-m-d') and date()|date('Y-m-d') <= end_date %}
  13.     {% set campaign_valid = true %}
  14. {% else %}
  15.     {% set campaign_valid = false %}
  16. {% endif %}
  17. {% set campaign_valid = true %}
  18. <div class="ec-headerSearch">
  19.     <form method="get" class="searchform" action="{{ path('product_list') }}">
  20.         <div class="ec-headerSearch__category">
  21.             <div class="ec-select ec-select_search">
  22.                 {{ form_widget(form.category_id, {'id': "category_search", 'attr': {'class': 'category_id'}}) }}
  23.             </div>
  24.         </div>
  25.         <div class="ec-headerSearch__keyword">
  26.             <div class="ec-input">
  27.                 {{ form_widget(form.name, {'id': null, 'attr': {'class': 'search-name', 'placeholder' : 'キーワードを入力' }} ) }}
  28.                 <button class="ec-headerSearch__keywordBtn" type="submit">
  29.                     <div class="ec-icon">
  30.                         <img src="{{ asset('assets/icon/tp_search.svg') }}" alt="">
  31.                     </div>
  32.                 </button>
  33.             </div>
  34.         </div>
  35.     </form>
  36. </div>
  37. {% if campaign_valid == false %}
  38. <script type="text/javascript" id="search_script">
  39.     var select_tag = document.getElementsByClassName("category_id");
  40.     var i = 0;
  41.     if(select_tag.length == 2){
  42.         i = 1;
  43.     }
  44.     var options = select_tag[i].options;
  45.     var options_array = Array.from(options);
  46.     var target_option = options_array.find(option => option.value === {{ sale_category_id }});
  47.     try {
  48.         select_tag[i].remove(target_option.index);
  49.     }catch(e){
  50.         
  51.     }
  52.     document.getElementById("search_script").remove();
  53. </script>
  54. {% endif %}