errorHtml = '<div data-rule-filled="true" class="t-form__errorbox-item js-rule-error js-rule-error-minorder" style="display: none;">' + tcart_dict('minimumOrder') + ': ' + tcart__showPrice(minimumOrderAmount) + '</div>'; tcart__renderMinimals(html, errorHtml); } if (window.tcart_mincntorder) { html = '<div class="t706__cartwin-prodamount-mincntorder t706__minimal"><span>' + tcart_dict('minimumQuantity') + ': ' + minimumQuantity + '</span></div>'; errorHtml = '<p data-rule-filled="true" class="t-form__errorbox-item js-rule-error js-rule-error-minquantity" style="display: none;">' + tcart_dict('minimumQuantity') + ': ' + minimumQuantity + '</p>'; tcart__renderMinimals(html, errorHtml); }}/** * Загружает корзину из localStorage, устанавливает отображение валюты **/function tcart__loadLocalObj() { var dataJsonStr = null; var timestamp; var delta; try { dataJsonStr = localStorage.getItem('tcart'); } catch (e) { console.error('Your web browser does not support storing a Cart data locally.'); } if (dataJsonStr === null) { window.tcart = tcart__nullObj(); } else { window.tcart = JSON.parse(dataJsonStr); } // удаляет из window.tcart пустые или удаленные товары if (window.tcart['products'] !== undefined) { var actualProductsObj = []; var oldCountProducts = window.tcart['products'].length; window.tcart['products'].forEach(function (product) { if (!tcart__isEmptyObject(product) && product.deleted !== 'yes') { actualProductsObj.push(product); } }); window.tcart['products'] = actualProductsObj; var actualCountProducts = window.tcart['products'].length; if (actualCountProducts !== oldCountProducts) { tcart__saveLocalObj(); } } // проверяет срок хранения в корзине if (window.tcart_maxstoredays) { var maxStoreDays = parseInt(window.tcart_maxstoredays); if (maxStoreDays > 0) { if (window.tcart.updated > 0) { timestamp = Math.floor(Date.now() / 1000); delta = timestamp * 1 - window.tcart.updated * 1; if (delta > 60 * 60 * 24 * maxStoreDays) { if (typeof localStorage === 'object') { window.tcart.products = []; localStorage.setItem('tcart', JSON.stringify(window.tcart)); } window.tcart = tcart__nullObj(); } } } else if (maxStoreDays === 0) { window.tcart = tcart__nullObj(); } } else if (window.tcart.updated > 0) { timestamp = Math.floor(Date.now() / 1000); delta = timestamp * 1 - window.tcart.updated * 1; if (delta > 60 * 60 * 24 * 30) { window.tcart = tcart__nullObj(); }