I am creating a food ordering app, and I have a problem that I don´t know to resolve. I have created de -_+ count following this other post (Item quantity count), but when the same user enters again in the app to do another order, the order items quantities in the counter appear with the same quiantity as in the previous order (see screenshot).
What can I do to make this count to 0 when the same user enter (once he has already make an order)?
It’s hard to answer that without seeing how your database is structured.
I assume that is the total items in your cart?
If so, how I’ve set up apps that have orders like this, is there is an order item created and a cart created during the process. This totals number would be a count of the carts order items.
If you +/- in your list it should add / remove the order item from the cart effectively reducing or adding to that number.
Also keep in mind it may not update in real time, if it doesn’t you could do something like make it a list of order items, but only show one item in the list which is the count of all order items for that cart and set that list to automatically update so that it updates in real time.
What I don´t know how to do is show the cart with all the older items so that only shows the last order item. It is to say, what I now have is the order list with all the order items, but if you order 1+ items of the menu, it appears more than once. I don´t know if I have explained well.
My database is conformed by orders, order items and menu items. An order is created every time someone enters the app, and then it is created an order item when this user click in one item of the menu.
In the ordering app in resources category, the order items dont have the field quantity in collections, so every time you click in the item, it is created a new order item.
Having the field quantity you can update the order and add the current quantity +1. That is how I have it configured, because in the summary of all the order items selected, I want that if the user has selected the same item more than once, only appear once in this summary, showing the quantity selected. I hope now is clear.
But my question is the following: When this same user enters again in the app to do another order, in the counter of quantity inside the menu, it appears the quantity of the previous order. What I want is the counter to be 0 again, to not get the user confused. Do you know how I can do that?
I send you a video to make it clearer.
As you can see, the user start an order and adds two items to the order, then complete the order. If I exit the app and enter again, I start a new order, but in the menu the quantities in the counter are the ones of the previous order. How can I make them to be 0 again?
The database and relationships between collections is exactly the same than in this other post: Item quantity count - #9 by projectlinuxsupports
If you need an exact screenshot for anything in particular, I can send it to you. Than you in advance!
The cloneable app doesn´t have a quantity field, so it doesn´t work the same as my app.
More info, here is where my problem is (I think): in database relationship I have:
One order can have multiple order items, and
One order item belongs to one order
But if I finish an order (already paid) and start a new one, the order items of the previous order are sometimes also included, and that could be the reason why in the counter field the quiantity is not accurate.
I send a clone app just in case you may see something wrong in my configuration. Thank you!