2401window.tcart['products'][index]['amount'] =2402// @ts-expect-error ST-2949_22403window.tcart['products'][index]['price'] * window.tcart['products'][index]['quantity'];2404// TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551)2405// @ts-expect-error ST-2949_12406window.tcart.products[index]['amount'] = tcart__roundPrice(window.tcart.products[index]['amount']);2407// TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015)2408// @ts-expect-error ST-2949_22409window.tcart['products'][index]['ts'] = timestamp;2410isInCart = true;2411
return false; } } // одинаковый товар по uid (опционально: по опциям тоже) // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015) // @ts-expect-error ST-2949_2 else if (productInCart['uid'] && productObj['uid'] && productInCart['uid'] === productObj['uid']) { // @ts-expect-error ST-2949_2 if (typeof productInCart['options'] == 'object' && typeof productObj['options'] == 'object') { Array.prototype.forEach.call(productInCart['options'], function (option, index) { // @ts-expect-error ST-2949_2 if (typeof option == 'object' && typeof productObj['options'][index] == 'object') { if ( // @ts-expect-error ST-2949_2 option['option'] !== productObj['options'][index]['option'] || // @ts-expect-error ST-2949_2 option['variant'] !== productObj['options'][index]['variant'] ) { // TODO ST-2949_5: assignability, arguments, calls, return types (TS2345, TS2322, TS2554, TS2769, TS2740, TS2739, TS2353, TS2349, TS2355, TS2366, TS2774, TS18046) // @ts-expect-error ST-2949_5 isEqualOptions = false; } // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015) // @ts-expect-error ST-2949_2 } else if (option === undefined || productObj['options'][index] === undefined) { // TODO ST-2949_5: assignability, arguments, calls, return types (TS2345, TS2322, TS2554, TS2769, TS2740, TS2739, TS2353, TS2349, TS2355, TS2366, TS2774, TS18046) // @ts-expect-error ST-2949_5 isEqualOptions = false; } return true; }); } else { // товар без характеристик и опций isEqualOptions = 'y'; } if (isEqualOptions === 'y') { // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015) // @ts-expect-error ST-2949_2 inv = parseInt(productObj['inv'], 10); // @ts-expect-error ST-2949_2 quantity = parseInt(productObj['quantity'], 10); // @ts-expect-error ST-2949_2 quantityInCart = parseInt(window.tcart['products'][index]['quantity'], 10); if (quantityInCart === inv) { alert(tcart_dict('limitReached')); productDataNeedsToBeUpdated = true; isInCart = true; } // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015) // @ts-expect-error ST-2949_2 if (productObj['quantity'] !== undefined) { if (quantityInCart + quantity > inv) { alert(tcart_dict('limitReached')); productDataNeedsToBeUpdated = true; isInCart = true; // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015) // @ts-expect-error ST-2949_2 window.tcart['products'][index]['quantity'] = inv; } else { // @ts-expect-error ST-2949_2 newQuantity = parseInt(window.tcart['products'][index]['quantity'], 10) + quantity; // @ts-expect-error ST-2949_2 window.tcart['products'][index]['quantity'] = newQuantity; } } else { // @ts-expect-error ST-2949_2 window.tcart['products'][index]['quantity']++; } // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) // @ts-expect-error ST-2949_1 window.tcart.products[index].price = 0; // @ts-expect-error ST-2949_1 window.tcart.products[index].amount = 0; // @ts-expect-error ST-2949_1 window.tcart.products[index].ts = timestamp; productDataNeedsToBeUpdated = true; isInCart = true; } } return true; }); } if (!isInCart) { // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015) // @ts-expect-error ST-2949_2