Aug 31, 2019 11:52 AM|mgebhard|LINK
There are a lot of problems with the code shown. The first query fetches IDs form the entire Carts table. Then it uses the same IDs to filter the same Carts table. This is redundant. The shoptotal variable in the foreach loop always contains the calculation
from the last item in the foreach loop.
We can't see the table design and I assume there are issue there as well.