* Add events for select * * @param {Node} productElement - product card */function t_prod__addEvents__options(productElement) { let element = productElement; // TODO: jqeury in js if (!(element instanceof Element)) element = element[0]; if (!element) return; var productSelects = element.querySelectorAll('.js-product-option-variants'); // Для одиночных опций Array.prototype.forEach.call(productSelects, function (select) { var product = select.closest('.js-product'); select.addEventListener('change', function () { t_prod__updatePrice(product); t_triggerEvent(document.body, 'twishlist_addbtn'); }); }); // Для мультиопций var multioptionCheckboxes = element.querySelectorAll('.js-product-multioption input[type="checkbox"]'); Array.prototype.forEach.call(multioptionCheckboxes, function (checkbox) { var product = checkbox.closest('.js-product'); checkbox.addEventListener('change', function () { t_prod__updatePrice(product); t_triggerEvent(document.body, 'twishlist_addbtn'); }); });}/** * Clear price from symbols * * @param {string} price - string convert number price * @returns {number} - return price */function t_prod__cleanPrice(price) { let newPrice = price; if (newPrice) { newPrice = newPrice.toString(); newPrice = newPrice.replace(',', '.').replace(/[^0-9.]/g, ''); newPrice = parseFloat(newPrice).toFixed(2); if (isNaN(newPrice)) newPrice = 0; newPrice = parseFloat(newPrice); newPrice = newPrice * 1; if (newPrice < 0) newPrice = 0; } else { newPrice = 0; } return newPrice;}/** * Number rounding * * @param {number} price - price * @returns {number} - price */function t_prod__roundPrice(price) { let newPrice = price; if (newPrice) { newPrice = parseFloat(newPrice).toFixed(2); newPrice = parseFloat(newPrice); newPrice = newPrice * 1; if (newPrice < 0) newPrice = 0; } else { newPrice = 0; } return newPrice;}/** * Transform price in string price * * @param {number} price - price * @returns {string} - str price */function t_prod__showPrice(price, options) { let priceToShow = price; if (!priceToShow) { priceToShow = ''; } else { priceToShow = priceToShow.toString(); if ( (window.tcart && window.tcart['currency_dec'] && window.tcart['currency_dec'] === '00') ||