Do you need the user to be able to pay for the items or just display the total(s) and submit one order? From what I understand, Adalo is not able to submit payment to two different vendors from a single order. On the other hand, if you don’t need the user to submit a payment, Here’s what I would do:
From what I can see, table one is redundant since you already provide the item name and format information in table 2.
You will need to create four databases for this to work:
- Users
- Product Items
- Order Items
- Orders
They will then need to be set up with the following relationships:
(keep in mind the Bold items below will change based on what you name your databases)
Users DB:
- Relationship to Order Items:
- An Order Item can only have one User. A User can have multiple Order Items.
- Relationship to an Order:
- An Order can only have one User. A User can have multiple Orders.
Product Items DB:
- No set Relationship.
- When a user clicks the add to cart button, it creates an Order Item.
Order Items DB:
- Relationship to User:
- A User can have multiple Order Items. An Order Item belongs to one User
- Relationship to Order:
- An Order can have multiple Order Items. An Order Item belongs to one Order.
Orders DB:
- Relationship to User:
- A User can have multiple Orders. An Order belongs to one User.
- Relationship to Order Items:
- An Order Item can only have one Order. An Order can have multiple Order Items.
You also need an “Add to Cart” button that creates a new Order Item. It should be set up like this:
Once your databases are set up, you will need to have a way for the user to “start and order” This will create a new order for the user and allow any items that have been created as an Order Item to be added to the current order. Without this function, your cart and checkout will pull any and all items from the user’s Order Items collection.
You then need to create a “Cart” page that will show a list of all of the items added to the cart. Where it gets tricky in your situation is if you want to be able to add multiple items to your “Cart” that shows a combined total based on the quantity. When an order item is created, it creates a new independent record within the collection and each time the add to cart button is clicked, it will create a new order item and not just update the quantity of the already added item. This is where conditional logic would be really helpful but not a feature that Adalo currently has.
You could technically add in a + or - quantity button on the cart page once the item has been created. This may get a bit confusing for the user however if they happen to hit the add to cart button multiple times to add multiple items. The + and - buttons would only affect the current item. They would have to delete any unwanted items manually.
Requiring the user to update quantities from the cart page would allow you to do the basic calculation to display the total price of the item based on quantity on the cart page. Just be sure you also set up an action to update the order item’s total price in the collection when the plus or minus button is pressed so it will properly calculate the vendor’s total on the checkout page.
On the “Checkout” page, You would need to add in separate custom lists for each vendor you have and filter the visibility based on the Vendor’s name. This is where you can display the total (Sum of the order item’s total) on a per/vendor basis and allow the user to submit their “order”.
If anyone has a better way of achieving any of the goals I have laid out above, I would love to hear any suggestions. This is simply based on my current understanding of how Adalo works and working within their limitations.