diff --git a/landingPage/script.js b/landingPage/script.js
index 95df8b0..5e0fc17 100644
--- a/landingPage/script.js
+++ b/landingPage/script.js
@@ -5,6 +5,8 @@ let cartList = [];
function cartItem(name, price, imageURL) {
this.name = name;
this.price = price;
+ this.quantity = 1;
+ this.quantity_price = price;
this.imageURL = imageURL;
}
@@ -47,10 +49,10 @@ function display_cartList() {
-
+
- PRICE: R${cartList[i].price}
+ PRICE: R${cartList[i].quantity_price}
@@ -65,3 +67,16 @@ function deleteCartItem(index) {
cartList.splice(index, 1);
display_cartList();
}
+
+//function to change the price when the quantity
+function handleQuantityChange(index) {
+ let quantity = document.getElementById(index).value;
+ let new_price = cartList[index].price * quantity;
+ cartList[0].quantity_price = new_price;
+
+ //also change the quantity in the dom
+ cartList[0].quantity = quantity;
+
+ //rerender the cartList display
+ display_cartList()
+}
diff --git a/landingPage/store.html b/landingPage/store.html
index 8260123..3c269b8 100644
--- a/landingPage/store.html
+++ b/landingPage/store.html
@@ -140,7 +140,7 @@ CART
-
+
PRICE: R500