t_store_product_disableUnavaileOptions(el_product, product);
6718 * Iterate through all product editions and find the one that matches the selected edition options 6720 * @param {HTMLElement} el_product - the product's DOM element 6721 * @param {object} product - options of product 6722 * @returns {null|*} - the edition object that matches the values in the controls 6724function t_store_product_detectEditionByControls(el_product, product) { 6725 var optionsData = t_store_option_getOptionsData(); 6727 // iterate via all product editions to find the selected one 6728 for (var i = 0; i < product.editions.length; i++) { 6729 var curEdition = product.editions[i]; 6730 // suppose that current edition is selected 6731 var isCurEditionSelected = true; 6733 if (!product.editionOptions) { 6734 product.editionOptions = t_store_product_getEditionOptionsArr(product, optionsData); 6737 // check match of all options values 6738 for (var j = 0; j < product.editionOptions.length; j++) { 6739 var curOption = product.editionOptions[j]; 6740 var el_select = t_store_product_getEditionSelectEl(el_product, curOption); 6743 var curControlVal = el_select.querySelector('.js-product-edition-option-variants').value; 6744 var curEditionVal = curEdition[curOption.name]; 6746 if (curControlVal !== curEditionVal) { 6747 isCurEditionSelected = false; 6752 // return current edition object, if all options values match the values from controls 6753 if (isCurEditionSelected) { 6762 * Adds the edition options to the product options 6764 * @param {object} product 6765 * @param {HTMLElement} productControlsWrapper - the div that contains all the options 6766 * @param {object} options 6767 * @param {string} recid 6769function t_store_product_addEditionControls(product, productControlsWrapper, options, recid) { 6770 var optionsData = t_store_option_getOptionsData(); 6771 var firstAvailabeEdition = t_store_product_getFirstAvailableEditionData(product.editions); 6773 if (!product.editionOptions) { 6774 product.editionOptions = t_store_product_getEditionOptionsArr(product, optionsData); 6777 product.editionOptions.forEach(function (curOption) { 6778 t_store_product_addOneOptionsControl( 6781 productControlsWrapper, 6783 firstAvailabeEdition, 6790 * Сообщает можно ли купить первую доступную вариацию товара, переключает состояние кнопок 6792 * @typedef {Object} ProdCard 6793 * @property {boolean} [showOpts] 6795 * @typedef {Object} Options 6796 * @property {ProdCard} [prodCard] 6798 * @param {string} recid 6799 * @param {Product} product 6800 * @param {HTMLElement} el_product