0
I took the code of a shopping cart on the internet. And there is the cart page where the customer can increase or decrease the quantity of the product. The problem with this code is that each time you increase or decrease a quantity it appears an "Updated amount" Alert, I have tried everything already deletes the part of code that has this Alert, already modified in php and so far Alert continues to be displayed. I wanted it to stop being displayed every time you update the amount. I’ll keep the code short, only the parts that matter.
Cart.js
add : function (id) {
// add () : add item to cart
// PARAM id : product ID
cart.ajax({
url : "4b-ajax-cart.php",
data : {
req : "add",
product_id : id
},
load : function (res) {
cart.count();
// @TODO
alert(res);
}
});
},
cart php.
<!--- Botão para aumentar e diminuir quantidade ---->
<td><input class="form-control" id='qty_<?= $id ?>' onchange='cart.change(<?= $id ?>);' type='number' value='<?= $qty ?>'/></td>
<!--- Fim botão para aumentar e diminuir quantidade ---->
/* [Aumentar e diminuir qty] */
case "change":
if ($_POST['qty'] == 0) {
unset($_SESSION['cart'][$_POST['product_id']]);
} else {
$_SESSION['cart'][$_POST['product_id']] = $_POST['qty'];
die ("Quantidade atualizada");
}
die ("Produto removido");
break;
If you removed that
alert
, cleared the cache and reloaded the page but it didn’t work, use the IDE to search all "Alert" inside the project folder, maybe there is another one besides this and didn’t notice– Costamilam