Forum Academy Marketplace Showcase Pricing Features

Please. This is really slowing me down

Hello. I am stuck. I am trying to calculate a grand total for a list of Drink products on my delivery app.

I have added the items into my database and when the Plus button is clicked the necessary information is sent to my ‘Shopping Cart’

However,



i a trying to add the Price and Quantity into the list of ‘Shopping Cart’ for a Grand total so the customer can check out and pay.

How can I get the input to calculate the price and quantity?

This has confused me for over 2 weeks now. and I am worried the issue may be some fields in my database. I have attached images of my work.

IF ANYONE CAN HELP EXPLAIN THIS TO ME IN A REALLY DUMBED SOWN VERSION you would be a life saver!!






I think that the way you have your shopping cart setup might be creating the issue for you. Right now, you are adding the drink to the shopping cart in the list, but what happens when a customer selects two different drinks with different prices and different quantities? To do this effectively, you need to add another table in your database that captures all the information to make that calculation.

Create a new table called line item. Give it the following fields:

  1. Drink (the drink type thing)
  2. Quantity (Number)
  3. Price (Number = price for each drink)
  4. Line Item Price (number = quantity x price)
  5. Shopping Cart (the shopping cart type thing)

Add a list of line items to the shopping cart. Now, when the customer adds a drink to their shopping cart, create a line item and add it to the Shopping Cart’s list of line items. When you are adding that line item to the shopping cart, you can update its cart price and quantity numbers with the following:

Quantity = Shopping Cart’s Shopping Order’s Quantity:sum
Cart Price = Shopping Cart’s Shopping Order’s Line Item Price:sum

Try that out and if it doesn’t get you to where you want to go, we can work something else out.

Hi Diaz…

Thank you for responding to me. I have tried to follow your steps… however I am still having an issue getting the price information to be calculated based on quantity and price into a grand total.




Also please feel free to tell me if there are some unnecessary data points in my data base. I think it may be also adding to my confusion

Look at the step where you are creating the new line item. Look at the field for Line Item Price. You are saving the item price twice, but in this field you need to change it so that it is the following:

Current cell’s Drink’s Drink Price * Quantity Input’s Value

Then in the shopping cart thing in your database, make sure that you have a List of Line Items field that you add all the line items too. Then for the shopping cart, you can use the following to calculate your cart total:

Shopping Cart’s List of Line Items’s Line Item Price:sum

You can then format it to currency or however you want to display it.

Hello Diaz…

Can i just say you have helped me massively. I have managed to successfully do the first part of your advice. and now I am getting a grand total displayed in my database.

However, I am still having trouble adding the Data to the shopping cart so that it can be displayed in the grand total.

Please find attached some pictures of the areas I think I’m going wrong. The highlighted Yellow captures the successful calculations





Thanks

I think the error is somewhere here.

Okay, so looking at what you got in the pictures, these could be possible causes for you:

  1. In the first picture, make sure that the “line items” field is a list of line items, then it should be set to “add” result of step 1.
  2. Is the second picture, you will need to add a step 3 that makes a change to result of step one. The only field changed would be the shopping cart and it will equal result of step 2.

For the last picture, I would recommend unchecking “Enable auto-binding on parent element’s thing”. You can keep this as an input, but a text element would word well as you don’t want your users changing this. Where you have the placeholder, you need to change it to “Parent group’s Shopping Cart’s line items:sum” or if you have a total price field on the shopping cart, use that one.