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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-cart-1.0.js

Код файла
Версия от 24.08.2026, 07:03:11 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
2001					inv = parseInt(productObj['inv'], 10);2002					quantity = parseInt(productObj['quantity'], 10);2003					quantityInCart = parseInt(window.tcart['products'][index]['quantity'], 10);2004 2005					if (quantityInCart === inv) {2006						alert(tcart_dict('limitReached'));2007						productDataNeedsToBeUpdated = true;2008						isInCart = true;2009						return;2010					}2011 2012
История файла и сравнение версий
  • 24.08.2026, 07:03:11 · 56c3b845
if (productObj['quantity'] !== undefined) {
2013 if (quantityInCart + quantity > inv) {
2014 alert(tcart_dict('limitReached'));
2015 productDataNeedsToBeUpdated = true;
2016 isInCart = true;
2017 window.tcart['products'][index]['quantity'] = inv;
2018 } else {
2019 newQuantity = parseInt(window.tcart['products'][index]['quantity'], 10) + quantity;
2020 window.tcart['products'][index]['quantity'] = newQuantity;
2021 }
2022 } else {
2023 window.tcart['products'][index]['quantity']++;
2024 }
2025
2026 window.tcart.products[index].price = 0;
2027 window.tcart.products[index].amount = 0;
2028 window.tcart.products[index].ts = timestamp;
2029 productDataNeedsToBeUpdated = true;
2030 isInCart = true;
2031 }
2032 }
2033 });
2034 }
2035
2036 if (!isInCart) {
2037 if (productObj['quantity'] === undefined) {
2038 productObj['quantity'] = 1;
2039 productObj['amount'] = productObj['price'];
2040 } else {
2041 productObj['amount'] = tcart__roundPrice(productObj['price'] * productObj['quantity']);
2042 }
2043 productObj['ts'] = timestamp;
2044 if (productObj.pack_m === '' || parseInt(productObj.pack_m, 10) === 0) {
2045 var gramms = false;
2046 var index = 0;
2047 ['GRM', 'KGM', 'TNE'].forEach(function (unit, i) {
2048 if (unit === productObj.unit) {
2049 gramms = true;
2050 index = i;
2051 }
2052 });
2053
2054 if (gramms) {
2055 productObj.pack_m = productObj.portion * Math.pow(1000, index);
2056 }
2057 }
2058 window.tcart['products'].push(productObj);
2059 tcart__showBubble(productObj.name + ' ' + tcart_dict('youAdd'));
2060 }
2061
2062 tcart__updateTotalProductsinCartObj();
2063 tcart__reDrawCartIcon();
2064 tcart__saveLocalObj();
2065
2066 if (productDataNeedsToBeUpdated) {
2067 tcart__updateProductsPrice(true);
2068 }
2069
2070 var cart = document.querySelector('.t706');
2071 var menuCartIcons = document.querySelectorAll('.t-menuwidgeticons__link_cart');
2072 if (cart.getAttribute('data-opencart-onorder') === 'yes') {
2073 setTimeout(function () {
2074 tcart__openCart();
2075 }, 10);
2076 } else if (cartIcon || menuCartIcons.length) {
2077 if (cartIcon) {
2078 cartIcon.classList.add('t706__carticon_neworder');
2079 setTimeout(function () {
2080 cartIcon.classList.remove('t706__carticon_neworder');
2081 }, 500);
2082 }
2083 if (menuCartIcons.length) {
2084 Array.prototype.forEach.call(menuCartIcons, function (menuCartIcon) {
2085 menuCartIcon.classList.add('t706__carticon_neworder');
2086 setTimeout(function () {
2087 menuCartIcon.classList.remove('t706__carticon_neworder');
2088 }, 500);
2089 });
2090 }
2091 }
2092}
2093
2094/**
2095 * Обновляет информацию о цене или наличии товара, если они изменились.
2096 *
2097 * На текущий момент два условия, когда вызывается данная функция:
2098 * 1. по времени - если прошло больше 3 часов от последнего обновления корзины
2099 * 2. и игнорируя текущее время - когда нужно незамедлительно обновить список товаров, например, когда в корзине уже присуствует товар N с ценой X,
2100 * и был добавлен ещё товар N, но с ценой Y
Предыдущие 100 строкСледующие 100 строк