Item quantity count

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 : Restaurant Order Menu Test App

8 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

hello , please iam a beginner with adalo. So please can you explain how did you obtain LIST 2 and LIST 3 ( Step 5 ) . Also can you give more details about the group components to mange the quantity in step 3 ? thanks you

Hi @nouahenri,

Welcome to the community :partying_face:

This post will help you! : Let's build Online Ordering App (clone-able)

And this may help you too! : Renew order items quantity - #11 by dilon_perera

Hope this helps!

Thank you

Hi thank you for your help. but i really want to now how to do this step by steph. i’am beginner so if you can help me by showing screen shot step by step mainly how to add and substract quantity with (-) and (+) buttons or component , i will be very gratefull.
Also is the possiblity to add me as team concerning let’s build online ordering app so that i can understand the way you build this . My email adress is nouahenri@gmail.com

On the two posts that I mentioned the apps are clonable so you can clone them and see the setup in your end!

If you need a video I will make a video.

how to clone the app please ? a video will be very helpfull

Click on the app and click the Clone button.

thanks ypu very much , lets me share my projet so that you help me . i want to add and substract item from order item
https://previewer.adalo.com/5f121d18-d926-4a7b-bea5-1fdc677b99d3

ok thanks you , i am wating the video pls

I will try to make a video when I’m free.

I have updated your app. Check it here : Lav'Tout Clone

If you have more questions creating a new topic will be great :+1:

hi bro , i really appreciate your help , this is great . thanks you for all . i want to learn adalo with you . what are your conditions

1 Like

Hi Friend i need your help

I want to learn how to add others order item from a New list without lose ( delect ) the current order item of the current order.
This is the link of my app , Can you help to do this.
Use this same app clone

@nouahenri create a new topic with the information.

Ok already done