erick21

Test 2

Jan 22nd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. var subTotal = [];
  2. async.forEachOf(cartitems, function (dataElement, i, inner_callback){
  3. console.log(i)
  4. let id = cartitems[i].products_id;
  5. modelProduct.getPriceById(id,(hasil)=>{
  6. if (!hasil) {
  7. console.log('err')
  8. inner_callback();
  9. } else {
  10. console.log(hasil[0].publish_price); //3000, 32000
  11. subTotal.push(hasil[0].publish_price);
  12. inner_callback();
  13. }
  14. })
  15.  
  16. }, function(err){
  17. console.log('subtotl '+ JSON.stringify(subTotal));
  18. });
Advertisement
Add Comment
Please, Sign In to add comment