щелкните по полю с кодом, нажмите комбинацию клавиш Ctrl+F и введите слово itemprop="price"
Везде, где встречается слово itemprop="price"
замените
class="price
на
class="main-price
(для строки Распродажа)
замените
class="price
на
class="price main-price
В шаблон main.js в самый конец добавьте код
$(function() { $(".products-grid .item .old-price").each(function() { if ($(this).is(":visible")) { let old = parseFloat($(this).find(".num").text().replace(" ", "")); console.log("old =" + old); let now = parseFloat($(this).closest(".price-box").find(".main-price .num").text().replace(" ", "")); now = Math.round(100 - now / (old / 100)); console.log("now =" + now); $(this).closest(".item").find(".product-image").append("<span class='ico-sale'>" + now + "%</span>"); } }) }) function goodsPercent() { if ($(".price-box").is(":visible")) { let old = parseFloat($(".old-price.goodsDataMainModificationPriceOld").find(".num").text().replace(" ", "")); console.log("old =" + old); let now = parseFloat($(".main-price.goodsDataMainModificationPriceNow .num").text().replace(" ", "")); console.log(now); now = Math.round(100 - now / (old / 100)); $(".price-box").append("<span class='ico-sale2'>" + now + "%</span>"); }}
В шаблон main.css в самый конец добавьте
.ico-sale2 {margin-left: 10px;background: #f9c800;color: #ffffff; padding: 2px 5px;font-size: 12px;}
В шаблон Товар в самый конец добавьте код
<script> setTimeout(function() { goodsPercent(); }, 500) </script>