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 main %}
  11.     <div class="products">
  12.       <div class="main-image"><img class="pc" src="/html/user_data/assets/img/products/main_image.jpg"><img class="sp" src="/html/user_data/assets/img/products/main_image_sp.jpg"></div>
  13.       <div class="content">
  14.         <div class="title"><img class="pc" src="/html/user_data/assets/img/products/title.svg"></div>
  15.         {% if products is not empty %}
  16.           <div class="ec-categoryNaviRole">
  17.               <div class="ec-itemNav">
  18.                   <ul class="ec-itemNav__nav">
  19.                       {% for product in products %}
  20.                           <li>
  21.                               <a href="" class="list-nav" category-id="{{ product["category"]["id"] }}">
  22.                                   {{ product["category"]["category_name"] }}<img src="/html/user_data/assets/img/products/arrow.svg">
  23.                               </a>
  24.                           </li>
  25.                       {% endfor %}
  26.                   </ul>
  27.               </div>
  28.           </div>
  29.           {% for product in products %}
  30.             <div class="category" id="Cat{{product["category"]["id"]}}">
  31.               <div class="category-title">
  32.                 <div class="en">{{product["category"]["en"]}}</div>
  33.                 <div class="ja">{{product["category"]["category_name"]}}</div>
  34.               </div>
  35.               <div class="items">
  36.                 {% for item in product["products"] %}
  37.                   <div class="item">
  38.                     <div class="img"><img src="/html/upload/save_image/{{item["product_image"][0]["file_name"]}}" /></div>
  39.                     <div class="name">{{item["name"]}}</div>
  40.                   </div>
  41.                 {% endfor %}
  42.               </div>
  43.             </div>
  44.           {% endfor %}
  45.         {% else %}
  46.           <div style="text-align:center;">商品はありません</div>
  47.         {% endif %}
  48.       </div>
  49.     </div>
  50. {% endblock %}
  51. {% block javascript %}
  52.   <script>
  53.     $(function() {
  54.       $(".list-nav").on("click",function(e){
  55.         e.preventDefault();
  56.         var category_id = $(this).attr("category-id");
  57.         var top = $("#Cat"+category_id).offset().top - 150;
  58.         $('html,body').animate({'scrollTop': top}, 500);
  59.       });
  60.     });
  61.   </script>
  62. {% endblock javascript %}