Product Quantity Counter

Hello everybody, new to Adalo here, hoping to get into developing apps for customer soon. In the meantime i’m creating a Catalog of Apps and learning everything I can about Adalo. So for one of the apps i’m developing, a food ordering app, i’m trying to do a counter for product quantity. See below an example:

image

I’m sure you have seen this in many modern apps. You use the "+"button to add a product quantity and “-” to substract a product quantity. In the middle is a counter that specifies how many you have selected.

I have seen the workflow on the “Food Truck Template” but there you add products on one screen (from a Products List) and in the next page you delete items (from a Order Items List). This is not what i want since it’s not very friendly to use.

Has anybody here had a similar issue? how did you solved ir? or does anyone have any idea on how to solve it?

2 Likes

This is possible, but it requires you to nest custom lists.

  1. Create a custom list of your menu options,
  2. then put a custom list inside that to be your list of orders filtered so that only 1 item shows (the current user’s current order),
  3. then you can put a custom list inside of that, filtered so that only the last order item shows which is in both that order and of the menu option type that you are in (eg, sort high to low by date and only show one result).

Put your two icons and text in this third-level list. Set the text in the middle to Current Order > Order Items > Count (filtered so Line Item Menu Option Name = Current Menu Option Name) - this will tell you how many of these are in the order.

When you ‘Add’, you can create a new order line item of that menu option in that order. This will become the one you see in the list (though you won’t know it’s changed). When you ‘remove’, tell it to delete the current order line item (because it is showing the latest one). This will delete on a last-in, first-out basis.

There’s quite a lot there, but it does allow you to build the cart all on one screen. When Adalo open up demo/read-only apps, I’ll be happy to build it for you so you can see how it works!

4 Likes

Thanks for the answer! Wow that is quite the hack!

I think I got the logic behind it, and was trying to implement it, but i´m runnning into an issue. This third level list is not showing at first (and icons+counter not visible) because when you access the screen there is no OrderItem created yet, so nothing is shown. Do I have to create one order item per menu item at first? how would I do that? I craeted this diagram to illustrate what I understood, please tell me if im correct.

You could have a group of icon and counter that is only visible if there are no order items for that product, which, when clicked, creates the order item.

That’s right @erickjbc - great diagram! You’re SO close.

So the way I’ve done it is how @Ben suggests - in that orange group, you can put a rectangle and text at the top; group those together. Text might be something like “Add to cart”. Have that group show when Current Order > Order Items > Count (Item Type = current MenuItems type) = 0 and have it create an order item of that type.

When you click it, it will disappear and the icons and counter will appear for that line instead.

Thereafter, if you have one item and remove it using the (-) icon, the icon and counter will disappear and the original ‘add to cart’ button will reappear.

You can see how that might work here: Dropbox - Screen Recording 2020-04-08 at 08.52.03.mov - Simplify your life

Thanks a lot! Got it working now, did a little twist on the solution, got the (+) icon on the blue list and the (-) and counter on the orange list. That way the (+) is always visible, and the (-) and counter are visible when there is at least one item added.

Thanks again!

2 Likes

Hi,
I’m working on something similar, so I was wondering if you don’t mind sharing how you got yours to work. Maybe like a visual representation of steps taken would help.
Thank you!

1 Like

Hi, have to intention to nudge an old post. But I was wondering how do you nests a custom lists?

To nest a custom list, you simply place a list in another list - make your first list pretty big to start with, so that you can drop the second (and subsequent) lists in.

@dosandco

Oh, silly me. Could have never thought of that by myself.

Thanks a bunch!

1 Like

Why Is this so difficult to do? I have been trying to accomplish the same thing for 2 weeks lol. It just deletes the items every time.

What are you trying to achieve, maybe I can help?

Hi all, this is definitely a killer feature but a bit complex to integrate. Is anyone can create a clone kit or an ecommerce template with this feature? Thks!

1 Like

Hi all, Appreciate this can be available for cloning app as I have seen many community members trying to get this up and often need to figure out this hack. @Ben appreciate if the food truck clone can be updated with this hack as I also struggle to get this done.

Hi all, Can you share a screen shot or a better description of the filter used for the second level list of Orders. Under normal filters I do not see “logged in user > current order” as an option and I can not seem to make this as a custom filter either. Consequently my second level list is displaying far too many objects.

For more information here is a screenshot of the filter options I have.

Trip = Order
Trip timeslot = order item
timeslot = menu item

So I am looking for current users > current trip but all options seem to lead to showing the current user’s whole list of trips/orders