Skip to content
Snippets Groups Projects
Commit 04707c5f authored by totoW's avatar totoW
Browse files

shopping cart changes

parent 14fe090e
No related branches found
No related tags found
No related merge requests found
...@@ -342,9 +342,13 @@ include("../html/data_treatment/connect_database.php"); ...@@ -342,9 +342,13 @@ include("../html/data_treatment/connect_database.php");
<input type="text" value="1" <?php echo 'id="quantity"'.$i; ?>> <input type="text" value="1" <?php echo 'id="quantity"'.$i; ?>>
<button onclick="incrementQuantity(this)">+</button> <button onclick="incrementQuantity(this)">+</button>
</div> </div>
<button class="btn btn-primary btn-xl text-uppercase" type="button" <?php echo 'id = "buttonShoppingCart'.$i.'"';?>> <button class="btn btn-primary btn-xl text-uppercase" type="button"
Add to shopping cart data-item-id="<?php echo $i; ?>"
</button> data-item-name="<?php echo $articles[$i]["itemName"]; ?>"
data-item-price="<?php echo $articles[$i]["price"]; ?>"
onclick="addToCart(this)">
Add to shopping cart
</button>
<script> <script>
function incrementQuantity(button) { function incrementQuantity(button) {
...@@ -418,24 +422,6 @@ include("../html/data_treatment/connect_database.php"); ...@@ -418,24 +422,6 @@ include("../html/data_treatment/connect_database.php");
<script src="https://cdn.startbootstrap.com/sb-forms-latest.js"></script> <script src="https://cdn.startbootstrap.com/sb-forms-latest.js"></script>
<script src="js/slideBox.js"></script> <script src="js/slideBox.js"></script>
<script> <script>
function incrementQuantity(button) {
var input = button.parentNode.querySelector('input');
var value = parseInt(input.value, 10);
input.value = value + 1;
}
function decrementQuantity(button) {
var input = button.parentNode.querySelector('input');
var value = parseInt(input.value, 10);
if (value > 0) {
input.value = value - 1;
}
}
function removeProduct(button) {
var product = button.parentNode.parentNode;
product.parentNode.removeChild(product);
}
function updateOnlineUsers() { function updateOnlineUsers() {
$.ajax({ $.ajax({
url: '../html/data_treatment/AJAX/online_Users.php', url: '../html/data_treatment/AJAX/online_Users.php',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment