- aggiungo campo "sfuso"

- aggiunto totale al carrello
This commit is contained in:
Surya Paolo
2024-02-11 16:33:00 +01:00
parent e7b0fd1d95
commit 9ca9ea6eaa
14 changed files with 41 additions and 17 deletions

View File

@@ -54,6 +54,9 @@ const orderSchema = new Schema({
type: Number,
default: 0,
},
TotalPriceProductstr: {
type: String,
},
TotalPriceProductCalc: {
type: Number,
default: 0,
@@ -362,6 +365,7 @@ module.exports.updateTotals = function (order) {
order.TotalPriceProductCalc += mypricecalc;
order.TotalPriceProduct += mypricecalc;
order.TotalPriceProductstr = parseFloat(order.TotalPriceProduct.toFixed(2));
return order;

View File

@@ -919,10 +919,12 @@ module.exports.getmsgorderTelegram = async function (ordersCart) {
if (ord.order.quantitypreordered > 0)
qtynum += ord.order.quantitypreordered;
// if (ord.order.product.productInfo.weight)
// qtynum *= ord.order.product.productInfo.weight;
if (ord.order.product.productInfo.sfuso && ord.order.product.productInfo.weight)
qtyrisult = qtynum * ord.order.product.productInfo.weight;
else
qtyrisult = qtynum + ' x ' + ord.order.product.productInfo.weight;
qtystr += qtynum + ' ' + tools.getUnitsMeasure(ord.order.product.productInfo.unit, true);
qtystr += qtyrisult + ' ' + tools.getUnitsMeasure(ord.order.product.productInfo.unit, true);
if (ord.order.quantitypreordered > 0)
qtystr += ' Pre-Ordinati';

View File

@@ -58,6 +58,9 @@ const productInfoSchema = new Schema({
type: Number,
default: 0,
},
sfuso: { // serve se moltiplicare le qta (es: 12 kg) oppure fare (2 x 20 ml)
type: Boolean
},
vegan: {
type: Boolean
},