Page 1 of 1

How can I add the price of an item selected together?

Posted: Thu Jun 27, 2013 10:48 pm
by adam griffin

I have created a shopping cart for my app. I'm trying to make the price of the items within my database add together as the user add to the cart. Can anyone help me with that?

I have a database of Product Names and Price of the product. As the user clicks what product they want, the app searches the database for the item id and returns the name of the product and price to the checkout page. How do I get the price of the items to add together or subtract from one another as the user select or deselect?


How can I add the price of an item selected together?

Posted: Fri Jun 28, 2013 3:01 am
by maxkatz

Any app UI logic is written in JavaScript. There are many good JS resources online. To add two numbers can be as simple as:

code
var num1;
var num2;
var total = num1 + num2;
/code