<script>
$(document).ready(function(){
let deliveriIndex = 2; //Номер позиции Самовывоза в списке
let discountTrigger = "price";  
let codeList = [
    [ 50,   '10%'   , 'DELIVERY'  ], //Промокод  в системе и размер его скидки в процентах
];
deliveriIndex--;
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_delivery').index($('input.t-radio_delivery:checked'));
    
    
    if (minTotal == codeList.length && upswing || radioIdx < 1 ) { 
        currentDiscount = [];clearDiscount();upswing=false;
        if(pcLid != undefined ){
            $('.t-input-group_pc').show();
            $('.t-inputpromocode__wrapper').html(saveinputPC);
            t_input_promocode_init(cartID,pcLid);
        };
    };
    
    
    if(currentDiscount.length && radioIdx>0 ){
        
        
        $('.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();
    };
};
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();
    };
};
$(".t706__cartwin-prodamount").bind( 'DOMSubtreeModified',function() {
    if (discountTrigger=="price"){triggerValue = window.tcart.prodamount;}else{triggerValue = window.tcart.total}; getDiscountInfo(triggerValue);
});        
});
</script>

<style>
.t706__cartwin-totalamount-wrap {
    display: block !important;
    order: -1;
    margin-bottom: 25px;
}
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: "Скидка за самовывоз:";
    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}
.t706__orderform { margin-top: -5px}
</style>
Studio Headphones
SKU: 700.954.29
1000
₽
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.
О нас
Book design is the art of incorporating the content, style, format, design, and sequence of the various components of a book into a coherent whole. In the words of Jan Tschichold, "methods and rules upon which it is impossible to improve, have been developed over centuries. To produce perfect books, these rules have to be brought back to life and applied."
Front matter, or preliminaries, is the first section of a book and is usually the smallest section in terms of the number of pages. Each page is counted, but no folio or page number is expressed or printed, on either display pages or blank pages.
Book design is the art of incorporating the content, style, format, design, and sequence of the various components of a book into a coherent whole. In the words of Jan Tschichold, "methods and rules upon which it is impossible to improve, have been developed over centuries. To produce perfect books, these rules have to be brought back to life and applied."
Front matter, or preliminaries, is the first section of a book and is usually the smallest section in terms of the number of pages. Each page is counted, but no folio or page number is expressed or printed, on either display pages or blank pages.
Book design is the art of incorporating the content, style, format, design, and sequence of the various components of a book into a coherent whole. In the words of Jan Tschichold, "methods and rules upon which it is impossible to improve, have been developed over centuries. To produce perfect books, these rules have to be brought back to life and applied."
Front matter, or preliminaries, is the first section of a book and is usually the smallest section in terms of the number of pages. Each page is counted, but no folio or page number is expressed or printed, on either display pages or blank pages.
Book design is the art of incorporating the content, style, format, design, and sequence of the various components of a book into a coherent whole. In the words of Jan Tschichold, "methods and rules upon which it is impossible to improve, have been developed over centuries. To produce perfect books, these rules have to be brought back to life and applied."
Front matter, or preliminaries, is the first section of a book and is usually the smallest section in terms of the number of pages. Each page is counted, but no folio or page number is expressed or printed, on either display pages or blank pages.
More products
Made on
Tilda