© 2016 Your company
Электро-велосипед Forward 123
Электро-велосипед Forward 456
Электро-велосипед Forward 322
Электро-велосипед Forward 111
Quiz
What kind of traveler are you?
Test your knowledge and find out how well you know geography and what kind of traveler are you. Can you answer these questions?
Take the quiz
What is the capital city of Australia?
Nope! Melbourne isn't the capital of Australia.
Right! Canberra is the capital of Australia.
Nope! Sydney isn't the capital of Australia.
Nope! Wellington is the capital city of New Zealand.
Next
Check
Show results
What city does not exist in Canada?
Vancouver is a major city in western Canada.
Ottawa is the capital city of Canada.
Right! Anchorage is not located in Canada, it is the largest city in Alaska.
Winnipeg is the capital of the Canadian province of Manitoba.
Next
Check
Show results
Which countries have a city named Moscow?
Nope! There is no city named Moscow in Finland.
Correct! There are several towns named Moscow in the USA.
Correct! There is a village named Moscow in South India.
Correct! Moscow is the capital of Russia.
Next
Check
Show results
What country is not a part of Scandinavia?
Nope! Norway is a Scandinavian country.
Nope! Finland is a Scandinavian country.
Correct! The Netherlands is not part of Scandinavia. 
Nope! Island is not part of Scandinavia. 
Next
Check
Show results
Which island does not belong to Italy?
Nope! Capri is an Italian island.
Sicily belongs to Italy.
Sardinia is a large Italian island in the Mediterranean Sea.
Right! Corsica is one of the eighteen regions of France.
Next
Check
Show results
You are homebody
Looks like you don't like to travel or just don't know geography very well :) 
Restart
You are a beginner traveler
Looks like you enjoy traveling and know something about geography
Restart
You are a real traveler
You adore traveling and know everything about geography
Restart
  1. Создали Zero с оформленными карточками товара
  2. Иконке сердечка задаём ссылку вида #fvr:Электро-велосипед Forward 123 , где #fvr: это обязательная часть, а остальное название товара точно как в каталоге
  3. Создаём блок ST305N на этой странице и задаём ему в настройках класс uc-mn-block
  4. Создаём блок избранного ST110
  5. Добавляем код в блок Т123

<script>
$( document ).ready(function() {

let productLink = {
    "Электро-велосипед Forward 322"   : "/thank-you",
    "Электро-велосипед Forward 123" : "/thank-what",
    "Электро-велосипед Forward 456" : "/thank-who",
    "Электро-велосипед Forward 111" : "/thank-why"
};




function prodComplete(){
//При загрузке товаров
let tistore = setInterval(function() {
    setTimeout(function(){
        if ( $('.uc-mn-block .js-store-grid-cont div').length>0 || $('.t-store__prod-snippet__container').length>0 ){
            clearInterval(tistore) 
            setTimeout(function(){
                checkFavorites();
           }, 200); 
        };
    }, 600);
    
}, 100);   
};
prodComplete();


function checkFavorites(){
    $('.uc-mn-block .t-store__card.t-col').each(function(){
        let card = $(this);
        let cardName = card.find('.js-store-prod-name').text();
            let heart = card.find('.t1002__addBtn');
            if(heart.hasClass('t1002__addBtn_active')){
                $("a[href='#fvr:"+cardName+"']").addClass('active-favorites');
            };
    });
};

function changeLink(){
    setTimeout(function(){
        
        if(twishlist.products.length){
        
            let lastFavorName =  twishlist.products[twishlist.products.length-1].name;
            
            $.each(productLink, function( key, value ) { 
                if( key == lastFavorName ){
                    twishlist.products[twishlist.products.length-1].url = value;
                    
                    setTimeout(function(){ 
                                twishlist__saveLocalObj();
                                twishlist__reDrawProducts()
                    }, 100);
                    
                };
            });
        };
        
        
    }, 500);    
};


//При добавлении товара в избранное
$(document).on('click',' a[href^="#addtofavorites:"] ',function(e){ 
    changeLink();
});

//При нажатии избранного из Zero
$(document).on('click','a[href^="#fvr:"]',function(e){ 
    e.preventDefault();
    let btn = $(this);
    let link = btn.attr('href');
    let prName = link.split(':')[1];
    
    $('.uc-mn-block .t-store__card.t-col').each(function(){
        
        let card = $(this);
        let cardName = card.find('.js-store-prod-name').text();

        if(prName==cardName){

            let heart = card.find('.t1002__addBtn');
            
            if(heart.hasClass('t1002__addBtn_active')){
                btn.removeClass('active-favorites');
            }else{
                btn.addClass('active-favorites');
            };
            heart[0].click();
        };
    });
    changeLink();
});

//Убираем активное состояние иконок избранного
$(document).on('click','.t1002__product-del',function(e){ 
    let prodName = $(this).closest('.t1002__product').find('.t1002__product-link').text();

    $("a[href='#fvr:"+prodName+"']").removeClass('active-favorites');
    
});


});
</script>


<style>
a.active-favorites:after {
    content: "";
    width: 100%;
    height: 100%;
    background-image: url(https://static.tildacdn.com/tild3333-3161-4330-a663-323239306338/icons8-----100_1.png);
    position: absolute;
    background-size: cover;
    top: 0;
    left: 0;
    transform: scale(1.05);
}
a.active-favorites img {
    opacity: 0;
}
.uc-mn-block{
    display: none;
}
</style>
Made on
Tilda