Суши-сет от шефа
SKU: 700.954.29
1400

<style>

.uc-upsell{
    display: none;
}


.t706__product.prod-spices {
    background: #f9f8f8;
}
.t706__product {
    border-radius: 10px;
    margin-bottom: 20px;
    padding: 0 15px;
}
.t706__product-title {
    font-size: 14px;
    font-weight: 500;
}
@media screen and (max-width: 640px){
.t706__product {
    border-radius: 10px;
    margin-bottom: 5px;
    margin-top: 5px;
    padding: 0px;
}
}

.t706__cartwin-products {
    display: flex;
    flex-wrap: wrap;
}
.t706__product.prod-spices {order: 1}    
.selectBlock {
    pointer-events:none;
    opacity:0.3;
}
.t-img-select__container.selectBlock:before {
    content: "";
    position: absolute;
    width: 70px;
    height: 70px;
    z-index: 99;
    background-image: url(https://static.tildacdn.com/tild6634-3364-4564-b331-616561623831/loading-50.gif);
    background-size: contain;
    background-repeat: no-repeat;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.t706 .t-img-select__container {
    position: relative;
}
</style>


<script>
$( document ).ready(function() {
let price = []; let titles = [];
let nameInp = "spices";
//Получаем цены за позиции, переписываем название
$('input[name="'+nameInp+'"]').closest('.t-input-block').find('.t-img-select__text').each(function(){
    let descript = $(this).closest('label').find('input.t-img-select').val();
    let descriptArr = descript.split('=');
    if (descriptArr.length==1) descriptArr[1]=0;
    price.push(+descriptArr[1]); titles.push(descriptArr[0]);
    $(this).text(descriptArr[0]);
    $(this).closest('.t-img-select__control').find('input').val(descriptArr[0]);
});

//При выборе/удалении доп позиции*******
$('input[name="'+nameInp+'"]').closest('.t-input-block').find("input:checkbox").on("change", function() {
        let cont = $(this).closest('.t-img-select__container');
        cont.addClass('selectBlock');
        setTimeout(function(){ cont.removeClass('selectBlock') }, 1500);
        let index = cont.find('input').index($(this)); 
        //let imgUrl = $(this).closest('.t-img-select__control').find('.t-bgimg').attr('data-original');
        //let prodLink = `#order:${titles[index]}=${price[index]}:::image=${imgUrl}`;
        
        
        //Если добавляют товар, то добавляем его в корзину
        
        if ($(this).is(':checked')){
            
            
            $('.uc-upsell .t-store__card.t-col').each(function(){
                
                let el = $(this);
                let title = el.find('.js-store-prod-name').text();
                if(title==titles[index]) el.find('.t-store__card__btns-wrapper a[href="#order"]')[0].click();

            });
            

                
                
                tcart__reDrawProducts();tcart__reDrawTotal();
            
        } else {
            //Если удаляют товар, то удаляем его из корзины
            $('.t706__product').each(function(){
               let cartPrTit = $(this).find('.t706__product-title a').text();
                if ( cartPrTit == titles[index] ) {
                    $(this).find('.t706__product-del').click();
                };
            });
        };
    });    

//Размечаем доп товары среди обычных
function addProdClass(){
    $('.t706__product').each(function(){
                let cartPrTit = $(this).find('.t706__product-title a').text();
                for (let i=0; i<titles.length; i++) {
                    if ( cartPrTit == titles[i] ) { 
                        $(this).addClass('prod-spices'); 
                    };
                };
    });
};

//Снимаем выбор при удалении товара
function deleteSpices(){
    let ptArr=[];
    $('.prod-spices').each(function(){
        let pt = $(this).find('a').text();
        ptArr.push($.trim(pt));
    });
    if(ptArr.length==0)  $('input[name="'+nameInp+'"]').closest('.t-input-block').find("input:checkbox").prop('checked', false);
    $('input[name="'+nameInp+'"]').closest('.t-input-block').find("input:checkbox").each(function(){
            let cb = $(this).val();
            cb = $.trim(cb);
            let rpt = false;
            for(let i=0; i<ptArr.length; i++ ){
                   if (cb == ptArr[i] ) rpt = true;
            };
            if (rpt){ $(this).prop('checked', true)
            }else{ $(this).prop('checked', false)};
    });
};

//Расставляем класс для добавленных опций
$(".t706").on('DOMSubtreeModified', ".t706__cartwin-prodamount", function() {
    setTimeout(function(){ addProdClass()}, 300);
    setTimeout(function(){ deleteSpices()}, 600);
    setTimeout(function(){ addProdClass()}, 4500);
});
});
</script>




OUR COMPANY
Bring Your Ideas to Life
Everything that you dreamed of can be brought to life exactly at the moment when you decide to win.
OUR COMPANY
Bring Your Ideas to Life
Everything that you dreamed of can be brought to life exactly at the moment when you decide to win.
OUR COMPANY
Bring Your Ideas to Life
Everything that you dreamed of can be brought to life exactly at the moment when you decide to win.
OUR COMPANY
Bring Your Ideas to Life
Everything that you dreamed of can be brought to life exactly at the moment when you decide to win.
OUR COMPANY
Bring Your Ideas to Life
Everything that you dreamed of can be brought to life exactly at the moment when you decide to win.
OUR COMPANY
Bring Your Ideas to Life
Everything that you dreamed of can be brought to life exactly at the moment when you decide to win.
OUR COMPANY
Bring Your Ideas to Life
Everything that you dreamed of can be brought to life exactly at the moment when you decide to win.
OUR COMPANY
Bring Your Ideas to Life
Everything that you dreamed of can be brought to life exactly at the moment when you decide to win.
OUR COMPANY
Bring Your Ideas to Life
Everything that you dreamed of can be brought to life exactly at the moment when you decide to win.
OUR COMPANY
Bring Your Ideas to Life
Everything that you dreamed of can be brought to life exactly at the moment when you decide to win.
OUR COMPANY
Bring Your Ideas to Life
Everything that you dreamed of can be brought to life exactly at the moment when you decide to win.
OUR COMPANY
Bring Your Ideas to Life
Everything that you dreamed of can be brought to life exactly at the moment when you decide to win.
OUR COMPANY
Bring Your Ideas to Life
Everything that you dreamed of can be brought to life exactly at the moment when you decide to win.
OUR COMPANY
Bring Your Ideas to Life
Everything that you dreamed of can be brought to life exactly at the moment when you decide to win.
OUR COMPANY
Bring Your Ideas to Life
Everything that you dreamed of can be brought to life exactly at the moment when you decide to win.
OUR COMPANY
Bring Your Ideas to Life
Everything that you dreamed of can be brought to life exactly at the moment when you decide to win.
Made on
Tilda