<style>
.uc-product-list {
display:none
}
.cart-btn-zero{
cursor: pointer;
}
.zero-price {
opacity: 0;
}
.zero-price.show-price {
opacity: 1;
}
</style>
<script>
function numberWithSpaces(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
}
document.addEventListener("DOMContentLoaded", function(){
let storeLoad = setInterval(function() {
if (document.querySelector('.uc-product-list .js-product.t-store__card_hidden')){
}else{
clearInterval(storeLoad);
setTimeout(function(){
$('.product-zero-name').each(function(){
let zeroPrName = $(this);
let zeroCard = zeroPrName.closest('.t-rec');
let productName = zeroCard.find('.product-zero-name .tn-atom').text();
let count = 0;
let cardLoad = setInterval(function() {
let product = document.querySelectorAll('.uc-product-list .js-store-grid-cont .js-product');
if (product.length && count<=77){
$('.uc-product-list .js-store-grid-cont .js-product').each(function(){
let pr = $(this);
let prName = pr.find('.js-product-name').text();
if(prName==productName){
clearInterval(cardLoad);
let img = pr.attr('data-product-img');
let price = pr.find('.js-product-price').attr('data-product-price-def');
$('.zero-price .tn-atom').text( numberWithSpaces(price)+' ₽');
$('.zero-price').addClass('show-price');
let link = `#order:${productName}=${price}:::image=${img}`;
$('.cart-btn-zero .tn-atom').attr('href', link);
};
});
}else{
count++; if(count>77){ clearInterval(cardLoad); console.log('Product not found'); };
};
}, 100);
});
}, 1000);
}
}, 100);
});
</script>