Hi! I’m creating an app for a store, but by now I use the same collection to store the shopping cart so I have two problems:
When I create a sale, the shopping cart doesn’t empty, the items remain, I don’t know what I can do to delete this items when I finish the payment.
If I log in with another user, I can see the items added by any another user so I need a different cart for each different user.
Please if somebody can help me with this I will appreciate so much! Thank you!!
Pd: sorry about my non native english
Yongki
November 13, 2021, 12:14am
2
Hi @Estebandeath ,
You could relate the shopping cart collection to users, so you can filter them with logged in user, in this case others will not see the same thing.
After payment, you can mark them with boolean field, so it can be filtered for next shopping cart.
1 Like
Just for know, the correct way to create a shopping cart is put all items that I select into the cart collection right? No matter that the items fill many fields or “cells” in the collection. And please, what relationship will be the best? A user can have multiple shopping carts? There is no one-one relationship
Yongki
November 13, 2021, 12:34am
4
Try multiple shopping carts have 1 user.
If you need more details, you can have shopping cart header and shopping cart detail.
Header can be linked to users as above, while detail linked to header.
Perhaps you can show your screenshots.
1 Like
Indeed, there is no one - one. You can just go with a one to many, it’ll make the job
1 Like
This is how I have my custom list/shopping cart, I make the relationship that you said but is still not working as I need
Yongki
November 13, 2021, 12:57am
7
You make the relationship in collections, not in screens.
The steps are almost the same when you want to add fields, but this time choose relationship.
I did that but nothing yet
No no, I have the relationship in collections, I just wanted to show how I show the items
Yongki
November 13, 2021, 1:30am
11
Then in the list, you can use filter such as logged in user>carritos.
1 Like
When I do that, the list appears empty
Yongki
November 13, 2021, 1:37am
13
If you want to fill them, user can choose from product list and do an action to create this cart.
1 Like
I can solve the problem!!! When I add a product, I did not save the current user in the relationship. Thank you so much Yongki! You helped me a lot!!
1 Like
system
Closed
November 23, 2021, 1:58am
15
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.