Created
April 2, 2020 12:44
-
-
Save Franckapik/d78c0efb1c996de22238463893633a7e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const saveProduct = panier.listeProduits.map((p, i) => { | |
const data = { | |
pid: p.id, | |
cartid: panier.cartid, | |
nom: p.nom, | |
quantite: p.qte, | |
prix: p.prix, | |
reduction: panier.reduction, | |
sous_total: p.qte * p.prix, | |
fdp: panier.fdp, | |
montanttotal: panier.montantTotal, | |
montanthorsfdp: panier.montantHorsFdp, | |
quantite_totale: panier.qteTotale, | |
userid: sessid, | |
hauteur: panier.hauteur, | |
poids: panier.poids, | |
unites: panier.unite, | |
nbcolis: panier.nbColis | |
} | |
return upsert('cart', { | |
userid: sessid | |
}, sessid, data, 'id'); | |
}) | |
return Promise.all(saveProduct) | |
.then(function(results) { | |
return results | |
}) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment