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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-cart-1.1.js

Код файла
Версия от 04.12.2026, 04:03:54 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
6901 6902	// TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551)6903	// @ts-expect-error ST-2949_16904	window.tcart.products.forEach(function (product) {6905		if (product.deleted === 'yes') return;6906		if (Object.keys(product).length === 0) return;6907		if (product.discountid) {6908			// TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015)6909			// @ts-expect-error ST-2949_26910			if (typeof usedDiscounts[product.discountid] === 'undefined') {6911				var discount = Array.prototype.find.call(window.t_cart__discounts, function (item) {
История файла и сравнение версий
  • 04.12.2026, 04:03:54 · 56c3b845
6912 return item.id == product.discountid;
6913 });
6914 // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015)
6915 // @ts-expect-error ST-2949_2
6916 usedDiscounts[product.discountid] = {
6917 // TODO ST-2949_6: operators / arithmetic / unintentional comparison (TS2362, TS2365, TS2367)
6918 // @ts-expect-error ST-2949_6
6919 value: (product.amount - product.amount_withdiscount).toFixed(2) * 1,
6920 typeid: discount && discount.typeid,
6921 is_loyalty: !!(discount && discount.is_loyalty),
6922 };
6923 } else {
6924 // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015)
6925 // @ts-expect-error ST-2949_2
6926 usedDiscounts[product.discountid].value +=
6927 // TODO ST-2949_6: operators / arithmetic / unintentional comparison (TS2362, TS2365, TS2367)
6928 // @ts-expect-error ST-2949_6
6929 (product.amount - product.amount_withdiscount).toFixed(2) * 1;
6930 }
6931 }
6932 });
6933
6934 // -Линейная/Дифференциальная- скидка от -кол-ва товаров/суммы заказа- : 100р
6935 var discountRulesArr = [];
6936 var discountRules = {
6937 0: {
6938 text:
6939 window.t_cart__browserLang == 'RU'
6940 ? 'Специальная скидка от кол-ва товаров'
6941 : 'Special discount from product amount',
6942 value: 0,
6943 },
6944 1: {
6945 text:
6946 window.t_cart__browserLang == 'RU'
6947 ? 'Специальная скидка от суммы заказа'
6948 : 'Special discount from total price',
6949 value: 0,
6950 },
6951 };
6952 var loyaltyDiscount = {
6953 text: tcart_dict('loyaltyProgram'),
6954 value: 0,
6955 };
6956
6957 Object.keys(usedDiscounts).forEach(function (id) {
6958 // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015)
6959 // @ts-expect-error ST-2949_2
6960 var usedDiscount = usedDiscounts[id];
6961 if (usedDiscount.is_loyalty) {
6962 loyaltyDiscount.value += usedDiscount.value;
6963 return;
6964 }
6965 var discountType = usedDiscount.typeid; // 0,2 - линейная 1,3 - дифференциальная
6966 if (typeof discountType !== 'number') return;
6967 discountRules[discountType < 2 ? 0 : 1].value += usedDiscount.value;
6968 });
6969
6970 Object.keys(discountRules).forEach(function (key) {
6971 // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015)
6972 // @ts-expect-error ST-2949_2
6973 if (discountRules[key].value !== 0) {
6974 discountRulesArr.push(
6975 // @ts-expect-error ST-2949_2
6976 discountRules[key].text +
6977 ': ' +
6978 // @ts-expect-error ST-2949_2
6979 (window.tcart['currency_txt_l'] ? window.tcart['currency_txt_l'] : '') +
6980 // @ts-expect-error ST-2949_2
6981 discountRules[key].value.toFixed(2) +
6982 // @ts-expect-error ST-2949_2
6983 (window.tcart['currency_txt_r'] ? window.tcart['currency_txt_r'] : '')
6984 );
6985 }
6986 });
6987
6988 var hasCatalogDiscount = discountRulesArr.length > 0;
6989 var hasLoyaltyDiscount = loyaltyDiscount.value !== 0;
6990
6991 if (hasLoyaltyDiscount) {
6992 discountRulesArr.push(
6993 loyaltyDiscount.text +
6994 ': ' +
6995 // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015)
6996 // @ts-expect-error ST-2949_2
6997 (window.tcart['currency_txt_l'] ? window.tcart['currency_txt_l'] : '') +
6998 loyaltyDiscount.value.toFixed(2) +
6999 // @ts-expect-error ST-2949_2
7000 (window.tcart['currency_txt_r'] ? window.tcart['currency_txt_r'] : '')
Предыдущие 100 строкСледующие 100 строк