как добавить избранное

в меню Zero block Tilda?

=
<!--settings{"comment":"","favoritesClass":"favorites","classForQuantity":"quantity","linkForZero":"","countForZero":"0","iconCart980":"0","scaleOnHoverOff":""}settingsend--> <style> .quantity { user-select: none; display: none; } .favorites { cursor: pointer; } .t1002__wishlisticon { display: none; } .t1002__wishlisticon-counter { display: none; } .blkElem { pointer-events: none; } .cartcopyanim2 { -webkit-animation: nolim__pulse-anim 0.6s; animation: nolim__pulse-anim 0.6s; } @-webkit-keyframes nolim__pulse-anim { 0% { -webkit-transform: scale(1) } 60% { -webkit-transform: scale(1.25) } 100% { -webkit-transform: scale(1) } } @keyframes nolim__pulse-anim { 0% { -webkit-transform: scale(1); transform: scale(1) } 60% { -webkit-transform: scale(1.25); transform: scale(1.25) } 100% { -webkit-transform: scale(1); transform: scale(1) } } </style> <script> (function() { function n_ready(t) { "loading" != document.readyState ? t() : document.addEventListener ? document.addEventListener("DOMContentLoaded", t) : document.attachEvent("onreadystatechange", function() { "loading" != document.readyState && ( a = setInterval(function(){ if(window.$){ clearInterval(a); t(); } },50), setTimeout(function(){ clearInterval(a); },10000) ) }) } n_ready(function() { let a = setInterval(function() { let wishElemsAtomList = document.querySelectorAll('.favorites .tn-atom'); if (wishElemsAtomList.length > 0) { clearInterval(a); findWish065(); } }, 50); setTimeout(function() { clearInterval(a); }, 10000); function findWish065() { let wishElemsList = document.querySelectorAll(".favorites"); wishElemsList.forEach(function(item) { if (item.getAttribute("data-elem-type") == "image") { item.style.position = "absolute"; let img = item.querySelector(".tn-atom__img"); img.onload = function() { item.style.height = img.height + "px"; }; } if (item.getAttribute("data-elem-type") == "vector") { item.style.position = "absolute"; let vector = item.querySelector(".tn-atom__vector svg"); let rect = vector.getBoundingClientRect(); vector.onload = function() { item.style.height = vector.height + "px"; }; } }); $('.favorites').click(function(e) { e.preventDefault(); let int = setInterval(function() { if (window.twishlist){ clearInterval(int); if (window.twishlist.total > 0) { typeof twishlist__openCart != 'undefined' ? twishlist__openCart() : twishlist__openWishlist(); } } }, 50); }); function showCount(state) { let int = setInterval(function() { if (window.twishlist){ clearInterval(int); let nlcountz = window.twishlist.total; $('.quantity .tn-atom').html(nlcountz); if (nlcountz == 0) { $('.quantity').css('display', 'table'); $('.favorites').css('pointer-events', 'none'); } else { $('.favorites').css('pointer-events', 'all'); $('.quantity').css('display', 'table'); } if (state == "click") { $('.favorites').addClass('cartcopyanim2'); setTimeout(function() { $('.favorites').removeClass('cartcopyanim2'); }, 1000); } else if (state == "openpage") {} } }, 50); } showCount("openpage"); document.querySelector('body').addEventListener("click", function(e) { if (e.target.closest('.t1002__addBtn') || e.target.closest('.t1002__product-del') || e.target.matches('[href*="#addtofavorites"]') || e.target.closest('[href*="#addtofavorites"]')) { showCount("click"); } }, true); } }); })(); </script>
0
Инструкция
1. Создаём своё меню в Zero block. Загружаем иконку для избранного и текст с цифрой "0" для количества

2. Элементам, которые будет отвечать за избранное и за количество товаров привязываешь class

Чтобы указать class у элемента, нажимаешь на него правой кнопкой мыши и выбираем из списка последнюю строку "Add CSS Class Name", далее справа в настройках указываем class

3. В генераторе указываем:
  • «Class для избранного» favorites
  • «Class для количества»quantity

4. Устанавливаем блок избранного (ST110) на страницу;

5. Копируем HTML код и вставляем его в блок Т123

Информация:
  • Код для модификации располагайте в footer сайта. Не в header!
  • Ссылка #showfavorites принадлежит стандартному виджету избранного, для пустого избранного указывайте любую другую ссылку.
  • Количество товаров можно сделать при помощи обычной кнопки. Задайте ей нужные размеры, цвет, а после этого добавьте к ней class
  • Текстовому элементу или кнопке укажите изначальное значение "0"
  • Не включайте настройку "Не показывать кнопку открытия виджета."
LET'S GO!
=
<!--NOLIM--><!--NLM065--><!--settings{"comment":"","favoritesClass":"nolimwish","classForQuantity":"wishnolimquantity","linkForZero":"","countForZero":"0","iconCart980":"0","scaleOnHoverOff":""}settingsend--> <style> .wishnolimquantity { user-select: none; display: none; } .nolimwish { cursor: pointer; } .t1002__wishlisticon { display: none; } .t1002__wishlisticon-counter { display: none; } .blkElem { pointer-events: none; } .cartcopyanim2 { -webkit-animation: nolim__pulse-anim 0.6s; animation: nolim__pulse-anim 0.6s; } @-webkit-keyframes nolim__pulse-anim { 0% { -webkit-transform: scale(1) } 60% { -webkit-transform: scale(1.25) } 100% { -webkit-transform: scale(1) } } @keyframes nolim__pulse-anim { 0% { -webkit-transform: scale(1); transform: scale(1) } 60% { -webkit-transform: scale(1.25); transform: scale(1.25) } 100% { -webkit-transform: scale(1); transform: scale(1) } } </style> <script> (function() { function n_ready(t) { "loading" != document.readyState ? t() : document.addEventListener ? document.addEventListener("DOMContentLoaded", t) : document.attachEvent("onreadystatechange", function() { "loading" != document.readyState && ( a = setInterval(function(){ if(window.$){ clearInterval(a); t(); } },50), setTimeout(function(){ clearInterval(a); },10000) ) }) } n_ready(function() { let a = setInterval(function() { let wishElemsAtomList = document.querySelectorAll('.nolimwish .tn-atom'); if (wishElemsAtomList.length > 0) { clearInterval(a); findWish065(); } }, 50); setTimeout(function() { clearInterval(a); }, 10000); function findWish065() { let wishElemsList = document.querySelectorAll(".nolimwish"); wishElemsList.forEach(function(item) { if (item.getAttribute("data-elem-type") == "image") { item.style.position = "absolute"; let img = item.querySelector(".tn-atom__img"); img.onload = function() { item.style.height = img.height + "px"; }; } if (item.getAttribute("data-elem-type") == "vector") { item.style.position = "absolute"; let vector = item.querySelector(".tn-atom__vector svg"); let rect = vector.getBoundingClientRect(); vector.onload = function() { item.style.height = vector.height + "px"; }; } }); $('.nolimwish').click(function(e) { e.preventDefault(); let int = setInterval(function() { if (window.twishlist){ clearInterval(int); if (window.twishlist.total > 0) { typeof twishlist__openCart != 'undefined' ? twishlist__openCart() : twishlist__openWishlist(); } } }, 50); }); function showCount(state) { let int = setInterval(function() { if (window.twishlist){ clearInterval(int); let nlcountz = window.twishlist.total; $('.wishnolimquantity .tn-atom').html(nlcountz); if (nlcountz == 0) { $('.wishnolimquantity').css('display', 'table'); $('.nolimwish').css('pointer-events', 'none'); } else { $('.nolimwish').css('pointer-events', 'all'); $('.wishnolimquantity').css('display', 'table'); } if (state == "click") { $('.nolimwish').addClass('cartcopyanim2'); setTimeout(function() { $('.nolimwish').removeClass('cartcopyanim2'); }, 1000); } else if (state == "openpage") {} } }, 50); } showCount("openpage"); document.querySelector('body').addEventListener("click", function(e) { if (e.target.closest('.t1002__addBtn') || e.target.closest('.t1002__product-del') || e.target.matches('[href*="#addtofavorites"]') || e.target.closest('[href*="#addtofavorites"]')) { showCount("click"); } }, true); } }); })(); </script>