function t_store_option_getOptionsData() {
8714 var productsOptions = window.tStoreOptionsList; 8716 if (!productsOptions) { 8722 for (var i = 0; i < productsOptions.length; i++) { 8723 var option = productsOptions[i]; 8724 var key = option.title; 8726 if (option.params && typeof option.params === 'string') { 8727 option.params = JSON.parse(option.params); 8730 if (option.values && typeof option.values === 'string') { 8731 option.values = JSON.parse(option.values); 8734 result[key] = option; 8741 * Checks it's a custom option 8743 * @param {object} curOption - option object 8744 * @returns {boolean} true or false 8746function t_store_option_checkIfCustom(curOption) { 8747 var params = curOption.params; 8748 if (!params || Array.isArray(params)) { 8752 if (params.view && params.view !== 'select') { 8756 if (params.hasColor || params.linkImage) { 8763 * It adds event listeners to the custom dropdown selectors 8764 * @param {string} recid 8765 * @param product - product card 8768function t_store_option_handleOnChange_custom(recid, product, options) { 8769 // Disable all events before add new ones, because this function is called in different places e.g. at popup open 8770 var editionOptionEvent = function () { 8771 var allrecords = document.getElementById('allrecords'); 8772 var isEditMode = allrecords && allrecords.getAttribute('data-tilda-mode') === 'edit'; 8774 var el_control = this.closest('.js-product-edition-option'); 8775 var el_custom_ui = el_control.querySelector('.t-product__option-variants_custom'); 8776 if (!el_control || !el_custom_ui) { 8777 setTimeout(function () { 8778 t_store_triggerEvent(document.body, 'twishlist_addbtn'); 8783 var value = this.value; 8784 var el_active_option = el_custom_ui.querySelector('.t-product__option-item_active'); 8786 // Update only if selected option of custom select !== value of hidden (updated) select 8787 if (el_active_option) { 8788 var el_input = el_active_option.querySelector('.t-product__option-input'); 8790 if (el_input.value !== value) { 8791 el_input.checked = false; 8792 value = (value || '').replace(/"/g, '\\"'); 8793 var el_upd_input = el_custom_ui.querySelector('.t-product__option-input[value="' + value + '"]'); 8794 setTimeout(function () { 8795 // Проверка для решения проблема закрытия панели редактирования при обновлении данных 8797 el_upd_input.click(); 8799 el_upd_input.checked = true;