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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-cart-1.1.js

Код файла
Версия от 04.12.2026, 04:03:54 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
2501		if (productObj['quantity'] === undefined) {2502			// @ts-expect-error ST-2949_22503			productObj['quantity'] = 1;2504			// @ts-expect-error ST-2949_22505			productObj['amount'] = productObj['price'];2506		} else {2507			// @ts-expect-error ST-2949_22508			productObj['amount'] = tcart__roundPrice(productObj['price'] * productObj['quantity']);2509		}2510		// @ts-expect-error ST-2949_22511		productObj['ts'] = timestamp;2512
История файла и сравнение версий
  • 04.12.2026, 04:03:54 · 56c3b845
// TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551)
2513 // @ts-expect-error ST-2949_1
2514 if (productObj.pack_m === '' || parseInt(productObj.pack_m, 10) === 0) {
2515 var gramms = false;
2516 var index = 0;
2517 ['GRM', 'KGM', 'TNE'].forEach(function (unit, i) {
2518 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551)
2519 // @ts-expect-error ST-2949_1
2520 if (unit === productObj.unit) {
2521 gramms = true;
2522 index = i;
2523 }
2524 });
2525
2526 if (gramms) {
2527 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551)
2528 // @ts-expect-error ST-2949_1
2529 productObj.pack_m = productObj.portion * Math.pow(1000, index);
2530 }
2531 }
2532 // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015)
2533 // @ts-expect-error ST-2949_2
2534 window.tcart['products'].push(productObj);
2535 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551)
2536 // @ts-expect-error ST-2949_1
2537 tcart__showBubble(productObj.name + ' ' + tcart_dict('youAdd'));
2538 }
2539
2540 tcart__updateTotalProductsinCartObj();
2541 tcart__reDrawCartIcon();
2542 tcart__saveLocalObj();
2543
2544 if (productDataNeedsToBeUpdated) {
2545 tcart__updateProductsPrice(true);
2546 }
2547
2548 var cart = tcart__getCartBlock();
2549 var menuCartIcons = document.querySelectorAll('.t-menuwidgeticons__link_cart');
2550 // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538)
2551 // @ts-expect-error ST-2949_3
2552 if (cart.getAttribute('data-opencart-onorder') === 'yes') {
2553 setTimeout(function () {
2554 tcart__openCart();
2555 }, 10);
2556 } else if (cartIcon || menuCartIcons.length) {
2557 if (cartIcon) {
2558 cartIcon.classList.add('t706__carticon_neworder');
2559 setTimeout(function () {
2560 // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538)
2561 // @ts-expect-error ST-2949_3
2562 cartIcon.classList.remove('t706__carticon_neworder');
2563 }, 500);
2564 }
2565 if (menuCartIcons.length) {
2566 Array.prototype.forEach.call(menuCartIcons, function (menuCartIcon) {
2567 menuCartIcon.classList.add('t706__carticon_neworder');
2568 setTimeout(function () {
2569 menuCartIcon.classList.remove('t706__carticon_neworder');
2570 }, 500);
2571 });
2572 }
2573 }
2574
2575 return undefined;
2576}
2577
2578/**
2579 * Обновляет информацию о цене или наличии товара, если они изменились.
2580 *
2581 * На текущий момент два условия, когда вызывается данная функция:
2582 * 1. по времени - если прошло больше 3 часов от последнего обновления корзины
2583 * 2. и игнорируя текущее время - когда нужно незамедлительно обновить список товаров, например, когда в корзине уже присуствует товар N с ценой X,
2584 * и был добавлен ещё товар N, но с ценой Y
2585 *
2586 * It sends a request to the server to check if the prices of the products in the cart have changed. If
2587 * they have, it updates the cart
2588 * @param ignoreTimestamp - if true, the function will ignore the timestamp and update the prices
2589 * anyway.
2590 * @param {{ strictPrice?: boolean }} [options] - дополнительные параметры запроса.
2591 * strictPrice: если true, передаёт в getpriceproducts strictprice=1, чтобы бэкенд строго сверял
2592 * цены позиций с актуальными (используется при повторе заказа из ЛК)
2593 **/
2594// TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015)
2595// @ts-expect-error ST-2949_2
2596async function tcart__updateProductsPrice(ignoreTimestamp, options) {
2597 // В секундах
2598 var now = Date.now() / 1000;
2599
2600 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551)
Предыдущие 100 строкСледующие 100 строк