- Aggiornamento template mail (tramite i campi in HTML)

- Aggiornato Carrello
This commit is contained in:
Surya Paolo
2023-12-28 00:50:35 +01:00
parent 15d831eecc
commit f23047bcd5
10 changed files with 96 additions and 29 deletions

View File

@@ -57,7 +57,7 @@ router.post('/:userId', authenticate, async function (req, res, next) {
try {
let mycart = await Cart.getCartByUserId(userId, idapp);
if (!order) {
return res.send({ code: server_constants.RIS_CODE_OK, cart: null });
}
@@ -85,14 +85,19 @@ router.post('/:userId', authenticate, async function (req, res, next) {
let newCart = CartClass.constructByCart(mycart);
// order = await Product.updateProductInOrder(order);
if (!nuovo) {
if (addqty) {
myord = await newCart.addqty(order);
} else if (subqty) {
myord = await newCart.subqty(order);
// Controlla se sto inserendo un prodotto con 2 Negozi, non permetterlo !
if (newCart.isSameStorehouse(order)) {
if (addqty) {
myord = await newCart.addqty(order);
} else if (subqty) {
myord = await newCart.subqty(order);
} else {
const ind = newCart.addItem(order);
const arrord = await Order.getTotalOrderById(order._id);
myord = arrord ? arrord[0] : null;
}
} else {
const ind = newCart.addItem(order);
const arrord = await Order.getTotalOrderById(order._id);
myord = arrord ? arrord[0] : null;
return res.send({ code: server_constants.RIS_CODE_ERR, cart: null, myord: null, msgerr: 'Non è possibile acquistare nello stesso ordine, su negozi differenti!' });
}
} else {
await newCart.updatetotals();