How to calculate total price based on product items and quantities