Некодим логотипНекодим
МодификацииПубликацииНекодИИмЦены
Некодим логотипНекодим

© 2020-2026 Некодим

Готовые модификации для вашего сайта. Улучшайте функциональность и дизайн без программирования.

Компания

  • Контакты
  • Публичная оферта
  • Политика конфиденциальности
  • Согласие на обработку данных
  • Лицензионное соглашение
  • Реферальная программа

Полезное

  • Модификации
  • Публикации
  • Каталог блоков Tilda
  • MCP для агентов
  • Журнал изменений
  • Доска почёта

Личный кабинет

  • Вход
  • Регистрация
  • Цены
Журнал измененийИстория GitФайлыTilda MCP
Каталог файлов

tilda-catalog-1.1.js

Код файла
Версия от 04.12.2026, 04:03:55 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
6701			if (tStore) {6702				t_store_triggerEvent(tStore, 'displayChanged');6703			}6704 6705			Array.prototype.forEach.call(6706				el_product.querySelectorAll('.js-product-edition-option-variants option'),6707				function (variantOption) {6708					variantOption.removeAttribute('disabled');6709				}6710			);6711			t_store_product__verifyOptionConsisency(el_product, product);6712
История файла и сравнение версий
  • 04.12.2026, 04:03:55 · 56c3b845
t_store_product_disableUnavaileOptions(el_product, product);
6713 });
6714 });
6715}
6716
6717/**
6718 * Iterate through all product editions and find the one that matches the selected edition options
6719 *
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
6723 **/
6724function t_store_product_detectEditionByControls(el_product, product) {
6725 var optionsData = t_store_option_getOptionsData();
6726
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;
6732
6733 if (!product.editionOptions) {
6734 product.editionOptions = t_store_product_getEditionOptionsArr(product, optionsData);
6735 }
6736
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);
6741
6742 if (el_select) {
6743 var curControlVal = el_select.querySelector('.js-product-edition-option-variants').value;
6744 var curEditionVal = curEdition[curOption.name];
6745
6746 if (curControlVal !== curEditionVal) {
6747 isCurEditionSelected = false;
6748 }
6749 }
6750 }
6751
6752 // return current edition object, if all options values match the values from controls
6753 if (isCurEditionSelected) {
6754 return curEdition;
6755 }
6756 }
6757
6758 return null;
6759}
6760
6761/**
6762 * Adds the edition options to the product options
6763 *
6764 * @param {object} product
6765 * @param {HTMLElement} productControlsWrapper - the div that contains all the options
6766 * @param {object} options
6767 * @param {string} recid
6768 **/
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);
6772
6773 if (!product.editionOptions) {
6774 product.editionOptions = t_store_product_getEditionOptionsArr(product, optionsData);
6775 }
6776
6777 product.editionOptions.forEach(function (curOption) {
6778 t_store_product_addOneOptionsControl(
6779 'editionopt',
6780 curOption,
6781 productControlsWrapper,
6782 options,
6783 firstAvailabeEdition,
6784 recid
6785 );
6786 });
6787}
6788
6789/**
6790 * Сообщает можно ли купить первую доступную вариацию товара, переключает состояние кнопок
6791 *
6792 * @typedef {Object} ProdCard
6793 * @property {boolean} [showOpts]
6794 *
6795 * @typedef {Object} Options
6796 * @property {ProdCard} [prodCard]
6797 *
6798 * @param {string} recid
6799 * @param {Product} product
6800 * @param {HTMLElement} el_product
Предыдущие 100 строкСледующие 100 строк