How do I aggregate the food items into single record?

0
Hi experts, I am creating a food ordering app. Here on the shopping cart page I need, for suppose a customer adds 3 pizza in his cart, so there should be only single record with pizza food item and the total quantity should say 3. I am able to get the total quantity as 3 but there is 3 rows of pizza visible but I want only 1 with itemquantiy as 3. Can anyone please help me with the same please? I have attached the ss below:   Domain model: cart page: Microflow to add the food item in database:            
asked
1 answers
2

When creating the orderline check if there is already an orderline with the same fooditem.

TO do this retrieve the list of orderlines and with a list operation perform a find operation where you compare the currently selected fooditem name with the name in the list. Then if something is found, the item was already in an orderline so you'll need to change the amount to amount +1. If nothing was found from the find operation you need to create the orderline and set the amount to 1.

answered