app/template/default/Common/EmbedGoodsPrice.twig line 1

Open in your IDE?
  1. <script>
  2.     $(function () {
  3.         //
  4.         const goodsPriceList = {{ goodsPriceList | json_encode | raw }};
  5.         //
  6.         $('.get-price-ajax').each(function () {
  7.             //
  8.             const $price = $(this);
  9.             const $list_price = $price.parent().prev('.through');
  10.             const goodsId = $(this).data('itemId');
  11.             const goodsPrice = goodsPriceList[goodsId];
  12.             const price = goodsPrice.min_price_in_tax;
  13.             const teika = goodsPrice.gp_teika_min;
  14.             const priceText = (price === null || isNaN(price)) ? price : parseInt(price).toLocaleString();
  15.             $(this).text(priceText);
  16.             // ぽちぽちブロック 商品バナー
  17.             if( $price.hasClass('managed-contents-block-list-price') ){
  18.                 $price.attr('data-price', price);
  19.                 var $contentsBlock = $price.closest('.managed-contents-block');
  20.                 var $listPrice = $('.managed-contents-block-retail-prices', $contentsBlock).attr('data-list-price', teika);
  21.                 $('.through', $listPrice).html( $list_price.html() );
  22.                 // SALEアイコン表示
  23.                 if( teika && parseInt(teika, 10) !== 0 ){
  24.                     var rate = parseInt(price, 10) / parseInt(teika, 10) * 100;
  25.                     var percentage = Math.round(100 - rate, 0);
  26.                     var svNum = Math.floor(Math.random() * Math.floor(10));
  27.                     $('.managed-contents-block-sale-icon img', $contentsBlock).attr('src', 'https://img'+svNum+'.land-mark.biz/ut_img/public_images/sale/left-bottom/percent_off_'+percentage+'.png');
  28.                 }
  29.                 else{
  30.                     $('.managed-contents-block-sale-icon', $contentsBlock).remove();
  31.                 }
  32.             }
  33.         })
  34.     })
  35. </script>