Studio Headphones
SKU: 700.954.29
700
руб.
When we first checked out our new headphones, we noticed the box said “improved bass”. We had to wonder if this was marketing jargon or the real thing? But it only took a moment to realize that bass was not kidding.
<script>
$(document).ready(function(){
let paymentIndex = 2; //Номер позиции Оплаты в списке
let discountTrigger = "price"; 
let codeList = [
    [ 50,   '5%'   , 'ONLINE'  ], //Промокод  в системе и размер его скидки в процентах
];
paymentIndex--;
let triggerValue=0;
let currentDiscount = [];
let upswing=false;
let saveinputPC='';
let cartID = $('div[data-record-type="706"]').attr('id').replace(/[^0-9]/g, '');
let pcLid = $('.t-input-group_pc').attr('data-input-lid');
setTimeout(function(){ saveinputPC = $('.t-inputpromocode__wrapper').html()}, 1000);

function getDiscountInfo(trval){
    let prevLine = 0;let minTotal = 0;
    for(let i=0;i<codeList.length;i++){
        if(trval >= codeList[i][0] && codeList[i][0] > prevLine ){prevLine = codeList[i][0];
            for (let j=0;j<2;j++){currentDiscount[j]=codeList[i][j+1]};upswing=true;
        }else if(trval < codeList[i][0]) minTotal++;
    };
    let radioIdx = $('input.t-radio_payment').index($('input.t-radio_payment:checked'));
    if (minTotal == codeList.length && upswing || radioIdx!=paymentIndex ) { 
        currentDiscount = [];clearDiscount();upswing=false;
        if(pcLid != undefined ){
            $('.t-input-group_pc').show();
            $('.t-inputpromocode__wrapper').html(saveinputPC);
            t_input_promocode_init(cartID,pcLid);
        };
        tcart__updateTotalProductsinCartObj();
        tcart__reDrawTotal();
    };
    if(currentDiscount.length && radioIdx==paymentIndex ){
        $('.t-input-group_pc').hide();
        window.tcart.promocode = {};
        let totalWrap = $('.t706__cartwin-totalamount-wrap');
        if(currentDiscount[0].indexOf('%') > 0 ){
            window.tcart.promocode.discountpercent = (+currentDiscount[0].replace(/[^0-9.]/g, '')).toFixed(2);
            clearTotalWrapClass();totalWrap.addClass('prcode_act_percent');
        }else{ 
            window.tcart.promocode.discountsum = currentDiscount[0]
            clearTotalWrapClass();totalWrap.addClass('prcode_act_summ');
        };
        window.tcart.promocode.message = "OK";
        window.tcart.promocode.promocode =  currentDiscount[1];
        tcart__updateTotalProductsinCartObj();
        tcart__reDrawTotal();
    };
};
function clearTotalWrapClass(){ $('.t706__cartwin-totalamount-wrap').removeClass('prcode_act_percent prcode_act_summ')};
function clearDiscount(){
    if ( window.tcart.hasOwnProperty("promocode") ){
       delete window.tcart.promocode; tcart__updateTotalProductsinCartObj();clearTotalWrapClass();
    };
};

function setDiscountStart(){
    setTimeout(function(){  
        if (discountTrigger=="price"){triggerValue = window.tcart.prodamount;}else{triggerValue = window.tcart.total}; getDiscountInfo(triggerValue);
    }, 500);
};
setDiscountStart();
$('input.t-radio_payment, .t706__carticon , a[href^= "#order"]').on('click', function() {   setDiscountStart();  });

});
</script>

<style>
.t706__cartwin-totalamount-wrap {
    display: block !important;
}
span.t706__cartwin-totalamount-label:before {
    content: "Сумма к оплате:";
    position: absolute;
    right: 10px;
    width: 300%;
    color: #000;
}
span.t706__cartwin-totalamount-label, .prcode_act_percent .t706__cartwin-totalamount-info span:nth-of-type(3) {
    position: relative;
    color: transparent;
}
.prcode_act_percent .t706__cartwin-totalamount-info span:nth-of-type(3):before {
    content: "Скидка за on-line оплату:";
    position: absolute;
    right: 1px;
    width: 300%;
    color: #000;
}
.prcode_act_summ .t706__cartwin-totalamount-info span:nth-of-type(3), 
.prcode_act_summ .t706__cartwin-totalamount-info span:nth-of-type(4), 
.prcode_act_summ .t706__cartwin-totalamount-info span:nth-of-type(4)+br {
    display: none;
}
.t706 .t-form__inputsbox {
    display: flex;
    flex-direction: column;
}
.t706__cartwin-bottom {display: none}
</style>
Made on
Tilda