- Aggiornamento template mail (tramite i campi in HTML)
- Aggiornato Carrello
This commit is contained in:
@@ -67,6 +67,8 @@ router.post('/import', authenticate, async (req, res) => {
|
||||
link: product.link,
|
||||
idCatProds: [],
|
||||
img: 'upload/products/' + product.code + '.jpg',
|
||||
weight: product.weight,
|
||||
unit: tools.getIdUnitsByText(product.unit),
|
||||
}
|
||||
|
||||
if (product.cat_name) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -78,7 +78,7 @@ router.post('/', authenticate, async (req, res) => {
|
||||
if (req.body.options !== null) {
|
||||
tools.sendBackNotif(subscription, req.body.options);
|
||||
}
|
||||
console.log('Subscription saved... ')
|
||||
// console.log('Subscription saved... ')
|
||||
return res.send({data: 'Subscription saved.'});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user