Order, Items and baskets - Help!

Hi,

I’m trying to create my first app with a client for purchasing. I’m struggling with the logic.

I have the following Tables:

  • Users
  • Products
  • Order Items
  • Orders

When a user clicks the product, they can add to basket (Adds an Order Item), they can keep adding to basket and will create Order Items.

When they go to the basket they will see a list of these order items and can purchase using stripe. This will create an Order.

This bit I can do but I want to then update all the current Order Items for that user with the Order number (From the Orders Table). I can’t seem to do this. am I doing something wrong? is the design wrong?

Please help

First of all, welcome!

No you’re not doing anything wrong. Batch actions, as we call them, are currently not possible with Adalo. BUT - you can change the workflow around so that the order is created first, before any items are added. This will allow each Order Item to have the Order number assigned to them as they are added.

Also, there’s a wonderful little trick by @Victor showing how to do a bulk update using the timer component: Bulk operations and Timer Tricks, part 3: mass update for the records

1 Like

Thanks, appreciate the welcome and the help.

I did think about that but wasn’t sure at what point to create the order. Ideally, it would be when the first item is added but then how would I define the first item?

When or how would you suggest doing this? it’s unusual for a user point of view to create an order first. Are there any clever ways of doing it? :grin:

Yes it can definitely feel strange, but the user’s don’t care about the backend really. They just care if it works. Let me work up a quick video for you.

1 Like

2 Likes

That’s great, I really appreciate you taking the time to do that. I think that will solve the problem, maybe I can I have a “shop” button that creates the order and deletes it if they back out as you described.

Last question :slight_smile: I had planned on having an Order ID using the Orders>Count + 1 method but I worry about order numbers being replicated if orders are deleted. Is that an issue here? is there a better way to generate order numbers?

I will attempt to replicate what you demonstrated. Thanks so much

What about using Max + 1 ? is that a better way to create order numbers?

Yes that’s a much better way to do it.

1 Like

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