Item quantity count

Hello everyone, Please i need help getting this to work, i have tried all i could to get it working. the examples i found here are a bit too hard to understand. Please i need help

thank you!

1 Like

Can you share some more context of how the screens and database in your app are set up?

Would a screenshot help?

Hi @alexanderjason. Any luck with the solution? Would very much like to know how does this work as well.

No luck still, and no one has been willing to help!

Hello, I think first of all you can’t have a separate Quantities Collection. You need to make that quantity as a field in the Menu (or maybe Current Order Items > Menu > Quantity).

After you have that quantity field bind to the menu, you just simply update the current Menu. And then add the current Menu > Quantity by 1.

Hope some of these screenshots can help you :

Image 4

Image 3 Image 2 Image 1

2 Likes

Hi @projectlinuxsupports

Also interesed by such project type :
So… in order to register properly the order,
the process could look like this, right ?
(…or am I missing something)
*using relationships between collections…
order process

Fedora :hugs:

This is easy in Adalo:

  1. You need an input field for that Zero 0 you will need to name it quantity
  2. Make those + - icons a button with action:
    Action could be
  3. The N Price filed is a textfield with formula (menu item price*quantity count) . The value of quantity field comes from input

There’s a video tut for this search working with formulas in Adalo

I’m sorry I don’t quite understand the image that you’re showing. But if I assume that this is a Restaurant menu ordering app (that the TS shows), maybe what we can build is something like this :

We need 3 Collections :

  1. Menus
    Menus Collection will hold all of the menu item database that the owner of the restaurant will input. This will hold all maybe the name of the menu, the price, the image, the description.

  2. Orders
    Orders is every order that the customer create. An Order will consist several Order Items records.And at the end will consist the total price of all the item that the customer order.

  3. Order Items
    Order items consists the quantity and the subtotal price of every menu that the customer orders.

We can add any additional field that we need. For example I add Order Number field and Order Item Field.

These are some of the screenshots of mine :

Image 3 Image 2 Image 1

Next, let’s talk about the relationship.

  1. Menu with Order Item (many to many)
    We want the customer can add and subtract the quantity of every menu that they’ll order right? So we need to link these 2 collections
  2. Order Item with Order (many to many)
    We want in every Order will consists all of the order item with the quantity and the subtotal price. So we can sum all of them at the end.
  3. Order with Users (1 order belong to 1 user, 1 user can have multiple order)
    This just to link who’s creating the order.

So the final result of our Collection will become like this :

Image 6 Image 5 Image 4

Now let’s begin with the steps

  1. First we need a button to create the order. Add the logged-in user to the user relationship, and add some count on the order number so we will have a different order number in every Order. Last, link this button to another screen that will shows all of the menu. Let’s call it Order Menu screen.

  2. In the Order Menu screen, we need to add 1 list that contains Menu Collection (no filter, because we assume we always want to show all of the menu to the customer). Always use Custom List in Adalo, because most of the time we will need to add another custom list inside those custom list.

  3. Now the hack is in here. At the moment, there is no Order Item record in every Menu record right? Because the customer is not yet order anything. So we need 1 groups of component that has only 2 objective : to shows 0 quantity & to create a new Order Item record. After this new order Item created, we will hide this group of components. That’s why we need to change the visibility of this components’s group to Sometimes Visible > Current Menu > order Items > Count > 0.


    This group only shows when customer have 0 quantity on that particular menu. Hope this make sense.

  4. Now we need to add actions to that plus button. I found that at least I need to add 3 actions :
    a. First, create a new Order Item
    b. Update that particular new Order Item to add the Current Order, add the Current Menu, calculate the quantity.
    c. Update again that particular new Order Item to calculate the Subtotal Price. (because I’ve found that if we calculate this subtotal price in point b., it always shows 0 subtotal because of the quantity still 0)
    Note : If you found a simpler way to achieve this, that’s would be fine!

  5. After the new Order Item created, it will hide that component’s group. So now what will we show to the customer? Of course a list of the new Order Item that’ve been made. But not the list itself we want to show, right? we want to show only the quantity.
    Hence We can copy our previous component’s group and make it a Custom List. This will be a Current Menu > Order Item.

    Image 9
    Hope, till this part still make sense to you.

  6. After point 5, everything will be much easier. Because we can now tap into all of the dynamic value of the Current Order Item. We can change the text with Magic Text that shows Current Order Item > Quantity. We can also add action to the Plus and Minus icon so it can add and subtract the Curren Order Item > Quantity.


  7. The last hack I’ve made is with the subtract icon. I need to make 2 conditional Actions. That if the number of Current Order Item > Quantity is equal to 1 and the customer click on it (so the quantity will turn to 0), I will delete that Current Order Item. Why? Because if the quantity is 0, that means the customer is not ordering that menu right? So we don’t want to include this Order Item anymore.


    And if the number of Current Order Item > Quantity is greater than 1 and the customer click on it (so the quantity let say from 5 turn to 4, from 4 to 3, from 3 to 2), this only the event that I will calculate the current quantity - 1.
    Image 18

I think that’s all for the “item quantity count” purpose.

For the final part, I want to show another tip to make the order summary page. Because here we need to again use the nested custom lists technique.

The main idea here is we want to show all of the Order Items of the Current Order. And inside each of the Order Item, we want to show what Menus that’s related to that particular Order Item.

That’s it. Hope all of this make sense for you, and make changes accordingly.

Here’s the test app that you can test it : https://previewer.adalo.com/cc6dda03-5ebe-45f4-b950-ece6dc67df0c

3 Likes

Yes its more or so for both in-house ordering as well as Delivery (lately Delivery has benefit many food places’ owners - that otherwise would have had to close for good :mask:)
Your pictures make lots of sense yes, great configuration !
…as for the create/update/update step, no I can not think of better way to do so, indeed I’m using the same method intuitively :ok_hand:
one dumb thing I had not figured out is how simple it is to create the Auto-increment ID by using…count() :see_no_evil:
had not tought of that but it makes so much sense now :smile:
for the rest i’ll have to build it to see it at work
thanks for the link too :yum:
Thanks for the great step by step walk through… :ok_hand:

@projectlinuxsupports

Wow, that was a very comprehensive explanation.

Works like a charm!

Thanks alot!

nice guide. but your test app has a bug.
as i tried to hit “+” 4 times quickly, it registers *4 times for price correctly. but it registers *2 count of menu item. i guess it differentiates price is calculated at phone device and item count needs to be recorded to database.
error