4301while (el_charcsContent.firstChild) {4302el_charcsContent.removeChild(el_charcsContent.firstChild);4303}4304el_charcsContent.insertAdjacentHTML('beforeend', charcsTextOnly);43054306if (i !== 0) {4307el_charcsContent.querySelector('.js-store-prod-dimensions').parentNode.style.display = '';4308}4309}4310});4311}4312
// add dimension if !== 0 if (isDimentions) { var dimension = pack_x + 'x' + pack_y + 'x' + pack_z; var fullDimension = window.tStoreDict['product-' + pack_label] + ': ' + dimension + ' ' + window.tStoreDict['mm']; var storeProdDimensions = el_popup.querySelector('.js-store-prod-dimensions'); if (storeProdDimensions) storeProdDimensions.innerHTML = fullDimension; if (isSnippet) { Array.prototype.forEach.call(el_tabCharcs, function (tabCharc) { var storeProdDimensions = tabCharc.querySelector('.js-store-prod-dimensions'); if (storeProdDimensions) { storeProdDimensions.innerHTML = fullDimension; } }); el_popup.setAttribute('data-product-pack-label', pack_label); el_popup.setAttribute('data-product-pack-x', pack_x); el_popup.setAttribute('data-product-pack-y', pack_y); el_popup.setAttribute('data-product-pack-z', pack_z); } } // add weight if !== 0 if (isWeight) { var fullWeight = window.tStoreDict['product-weight'] + ': ' + pack_m + ' ' + window.tStoreDict['g']; el_popup.querySelector('.js-store-prod-weight').innerHTML = fullWeight; if (isSnippet) { if (el_tabCharcs.length) { Array.prototype.forEach.call(el_tabCharcs, function (tabCharc) { var storeProdWeight = tabCharc.querySelector('.js-store-prod-weight'); if (storeProdWeight) { storeProdWeight.innerHTML = fullWeight; } }); } el_popup.setAttribute('data-product-pack-m', pack_m); } } // add data attributes for characteristics var storeProduct = el_popup.querySelector('.js-store-product'); if (isSnippet && el_popup.classList.contains('js-store-product')) { storeProduct = el_popup; } if (storeProduct) { storeProduct.setAttribute('data-product-pack-label', pack_label); storeProduct.setAttribute('data-product-pack-m', pack_m); storeProduct.setAttribute('data-product-pack-x', pack_x); storeProduct.setAttribute('data-product-pack-y', pack_y); storeProduct.setAttribute('data-product-pack-z', pack_z); storeProduct.setAttribute('data-product-url', productUrl); }}/** * Adding the product options to the product * * @param {string} recid * @param {object} product - options of product * @param {HTMLElement} productElement - the product element * @param {TildaStoreOptions} options **/function t_store_addProductOptions(recid, product, productElement, options) { var el_product = productElement; if (window.jQuery && el_product instanceof jQuery) { if (el_product.length === 0) { return; } el_product = el_product[0]; } var optionsWrapper = el_product.querySelector('.js-product-controls-wrapper'); if (!optionsWrapper) return; optionsWrapper.innerHTML = ''; var isSnippet = document.getElementById('allrecords') !== document.querySelector('.t-store__product-snippet') && document.getElementById('allrecords').contains(document.querySelector('.t-store__product-snippet')); var firstAvailabeEdition = t_store_product_getFirstAvailableEditionData(product.editions); /* product edition — is a combination of parameters with separate quantity and price example: "Blue XS T-Shirt" */ t_store_product_initEditions(recid, product, el_product, options);