I have a Cart model with product_price and quantity. I am writing a sequelize query to calculate the total as price * quantity Here's my query
db.Cart.findAll({
attributes: {include: [[db.sequelize.condition(db.sequelize.col('cart_quantity'), '*', db.sequelize.col('price')),'tot']]}
})
Sequelize documentatoin says to access the value of 'tot' we use instance.get('tot'). So in the results console.log(item.get('tot') displays correct value
.then(function(dbCart) { //We have access to the products as an argument inside of the callback function
dbCart.forEach(function(item){
console.log(item.get('tot'));
});
var hbsObject = {
products: dbCart,
};
res.render("shop/cart", hbsObject);
});
});
Now when I try to access the value in my carts.handlebars file I am unable to display or access the value of 'tot' {{# each products }} {{tot}} or {{Cart.tot}} or {{products.tot}} or {{products.get('tot')}} yields no value {{/each}} How do I access and display the value of 'tot' in handlebars? Thank you