Hey guys, how are you?
I’m trying to make a text element receive the subtotal sum data (a , but when I insert the dynamic data in this field, it doesn’t appear at all.
This cart item is within a repeating group and the text field is within a Floating Group.
When I try to search for the “ticket group”, which is where I need to get the subtotal information to present the sum, it does not appear in the list of page elements:
This is the floating group, as it will appear when receiving the data, in fact:
Is your "valor-total-soma-carrinh text element outside of your repeating group? I’m assuming it is. If so, you don’t get access to elements inside the repeating group. This is expected bubble behaviour. You will either have to:
have your item prices save to the database and then have a subtotal field in your db and then your text element accesses the db field.
set the item costs to a custom state on an element outside of the RG (but this gets tricky as bubble doesn’t allow you to have repeated items in a list
@paul29 I did some tests, but without success.
I inserted an input into the Repating group to obtain the multiplication of the ticket value and quantity.
The idea now is to obtain the data from each input, make a sum and update this result in the floating group.
Yah this will not work with custom states in a simple way. You can get it to work but as I mentioned, its tricky and not elegant. Bubble does not allow you to communicate from outside and RG into an RG
What is the reason you are wanting to do this with custom states as opposed to with the DB?
I did it this way, so as not to overload, perhaps, the database when several people are performing this action, in addition to making the fluid faster too. Because, when an item is deleted from the cart, in the database, the page always loads and it takes a while to perform this action and load the updated quantity into the database.
@levycamara the way I see it you can do it entirely on the front end with two simple custom states, quantity for the cell and total price for the page. Check if this is what you need:
quantity and total price are 0 by default. When + is clicked the price of a single ticket of this type is added to total and quantity is set to quantity+1, the opposite happens when (-) is clicked as long as quantity is > 0.
This way you can see quantity for each ticket and calculate total price with a single workflow on each click.
great I’m glad it did. Still, this does not create the records for order items in your database, which I assume you’re doing in batch on order confirmation.