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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-cart-1.0.js

Код файла
Версия от 24.08.2026, 07:03:11 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
1001				}1002 1003				// Декодируем название, так как HTML кодирует кириллицу в href1004				// Не трогаем весь payload до split('='), чтобы %3D в имени не ломал цену1005				if (name) name = t_cart__safeDecodeURIComponent(name).trim();1006 1007				// обрабатывает параметры1008				if (typeof imgLink !== 'undefined' && imgLink !== '') {1009					if (imgLink.indexOf('=') > 0) {1010						var imgLinkArr = imgLink.split('=');1011						if (imgLinkArr[0] && imgLinkArr[1]) {1012
История файла и сравнение версий
  • 24.08.2026, 07:03:11 · 56c3b845
if (imgLinkArr[0] == 'image' && imgLinkArr[1].indexOf('.tildacdn.') > 0) {
1013 img = imgLinkArr[1];
1014 }
1015 }
1016 }
1017 }
1018
1019 if (recid == '') {
1020 recid = cartBtn.closest('.r').getAttribute('id')
1021 ? cartBtn.closest('.r').getAttribute('id').replace('rec', '')
1022 : '';
1023 }
1024 }
1025 }
1026
1027 var productElement = cartBtn.closest('.js-product');
1028 if (productElement) {
1029 if (name == '') {
1030 var elementName = productElement.querySelector('.js-product-name');
1031 name = elementName ? elementName.textContent.trim() : '';
1032 }
1033 if (price == '' || price == 0) {
1034 var elementPrice = productElement.querySelector('.js-product-price');
1035 if (elementPrice) {
1036 if (elementPrice.classList.contains('js-store-prod-price-range-val')) {
1037 price = elementPrice.getAttribute('data-product-price-range-val');
1038 } else {
1039 price = elementPrice.textContent;
1040 }
1041 }
1042 price = tcart__cleanPrice(price);
1043 }
1044 if (img == '') {
1045 if (productElement.getAttribute('data-product-img')) {
1046 img = productElement.getAttribute('data-product-img');
1047 } else {
1048 var imgDiv = productElement.querySelector('.js-product-img');
1049 if (imgDiv) {
1050 var original = imgDiv.getAttribute('data-original') || '';
1051 if (original.length > 0) {
1052 img = original;
1053 } else if (imgDiv.tagName == 'IMG') {
1054 img = imgDiv.getAttribute('src');
1055 } else if (imgDiv.tagName == 'DIV') {
1056 img = '';
1057 var imgCss = getComputedStyle(imgDiv)['background-image'];
1058 if (imgCss) {
1059 img = imgCss.replace('url(', '').replace(')', '').replace(/"/gi, '');
1060 }
1061 }
1062 }
1063 }
1064 }
1065 if (lid == '') {
1066 lid = productElement.getAttribute('data-product-lid') || '';
1067 }
1068 if (uid == '') {
1069 uid = productElement.getAttribute('data-product-uid') || '';
1070 }
1071 if (recid == '') {
1072 var recidAttr = productElement.closest('.r').getAttribute('id');
1073 recid = recidAttr ? recidAttr.replace('rec', '') : '';
1074 }
1075
1076 if (inv == '') {
1077 inv = productElement.getAttribute('data-product-inv') || '';
1078 }
1079
1080 unit = productElement.getAttribute('data-product-unit') || '';
1081 portion = productElement.getAttribute('data-product-portion') || '';
1082 single = productElement.getAttribute('data-product-single') || '';
1083
1084 // варианты товара (с разными свойствами)
1085 var editionOptionsElements = productElement.querySelectorAll('.js-product-edition-option');
1086 Array.prototype.forEach.call(editionOptionsElements, function (optionsElement) {
1087 var optionName = optionsElement.querySelector('.js-product-edition-option-name').textContent;
1088 var selectedOption = optionsElement.querySelector('option:checked');
1089 if (selectedOption) {
1090 var optionVariant = selectedOption.value;
1091 var optionPrice = selectedOption.getAttribute('data-product-edition-variant-price');
1092 optionPrice = tcart__cleanPrice(optionPrice);
1093
1094 if (optionName && optionVariant) {
1095 var optionObj = {};
1096 if (optionName != '') {
1097 optionName = tcart__escapeHtml(optionName);
1098 }
1099 if (optionVariant != '') {
1100 optionVariant = tcart__escapeHtml(optionVariant);
Предыдущие 100 строкСледующие 100 строк