app/Plugin/HsdDiscountRate42/Resource/template/default/Product/discount_rate42_show_list.twig line 1

Open in your IDE?
  1. <style>
  2.     .hsd-badge {
  3.         display: inline-block;
  4.         min-width: 10px;
  5.         padding: 3px 7px;
  6.         font-size: {{ font_rate }}%;
  7.         font-weight: 700;
  8.         line-height: 1;
  9.         color: {{ font_color }};
  10.         text-align: center;
  11.         white-space: nowrap;
  12.         vertical-align: middle;
  13.         background-color: {{ back_color }};
  14.         border-radius: 10px;
  15.         position: relative;
  16.         vertical-align: text-bottom;
  17.     }
  18. </style>
  19. <script>
  20.     $(function () {
  21.         {% if is_show == 1 and is_listpage == 1 %}
  22.             {% for key, value in discount_rate %}
  23.                 {% if value['has_product_class'] == 1 %}
  24.                     var pcc_ritu{{ key }} = { {{ value['product_class_id_ritu'] }} };
  25.                     $('.ec-shelfGrid').find('li').eq({{ key }}).find('select').change(function(){
  26.                         var product_class_id = $('#ProductClass{{ value['product_id'] }}').val();
  27.                         if( product_class_id != '' ){
  28.                             var ritu = pcc_ritu{{ key }}[product_class_id];
  29.                             if( ritu > 0 && ritu <= 100 ){
  30.                                 $('.ec-shelfGrid').find('li').eq({{ key }}).find('.price02-default').append('<span class="hsd-badge" style="left: 3px;">{{ bef_txt }}' + ritu + '%{{ aft_txt }}</span>');
  31.                             }
  32.                         }
  33.                     });
  34.                 {% else %}
  35.                     {% if value['discount_rate_1'] > 0 and value['discount_rate_2'] > 0 and value['discount_rate_1'] != value['discount_rate_2'] %}
  36.                     $('.ec-shelfGrid').find('li').eq({{ key }}).find('.price02-default').after('<span class="hsd-badge">{{ bef_txt }}{{ value['discount_rate_1'] }}%{{ aft_txt }}</span> 〜 <span class="hsd-badge">{{ value['discount_rate_2'] }}%{{ aft_txt }}</span>');
  37.                     {% elseif value['discount_rate_1'] > 0 and value['discount_rate_1'] <= 100 %}
  38.                     $('.ec-shelfGrid').find('li').eq({{ key }}).find('.price02-default').append('<span class="hsd-badge">{{ bef_txt }}{{ value['discount_rate_1'] }}%{{ aft_txt }}</span>');
  39.                     {% endif %}
  40.                 {% endif %}
  41.             {% endfor %}
  42.         {% endif %}
  43.     });
  44. </script>