Renew order items quantity

Hi!

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.

Thanks Bobby, I understand.

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.


In this example, I order 2 “tarta chocolate” and 2 “tarta queso” and in the order list it appears twice each. How can I do so that it only show once?

This is how I have configured it now. If I put Maximun number of items = 1 it only shows one order item, but what I want is to show 1 order item of every item ordered.

Thank you for your help!

It’s still hard to tell without seeing your actual database structure, but you want to make sure your order items have a quantity so that you can add more than one.

Hi @javicrespo1 ,

You can check online ordering app, cloneable app in Resources category, it is free.

Thank you to both for your responses.

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?

After payment, order details are reset again, so it will become 0.

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!

1 Like

I will get back to you later.

But in the mean time, you can explore that cloneable app that I mentioned above.

Thank you Yongki.

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!

Hi @javicrespo1.

Check this out! : Restaurante Clonable

Thank you

That was a very good help, Dilon. Thank you so much!

1 Like

thank you for this! So basically the way to solve is, is by updating the “order item” 2 times. First, change the order quantity, then multiply the price with the recently updated quantity.

did I get that right?

There’s no way to do that in the same “update order” action?

Hi @axme ,

You can merge the actions to have better performance.

If quantity is added by 1, and at the same action, fill the total with (qty+1)*price.

The reasons for splitting the actions are for certain conditional and many-to-many relationship that need add/remove field.

1 Like

Yep!

I think Yongki has given the answer for this! Thanks Yongki! Missed this one! Updated the app!

1 Like

thank you @dilon_perera and @Yongki : together it makes for a perfect solution for the problem I was having.
Have a great day!

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.