laravelshoppingcart
laravelshoppingcart copied to clipboard
Update Cart Error When Update Only Work First Item
I have a problem. If I have 3 items. I can't update second item and third item. But the first item is working. If I update second item this item is replace first item. The first Item is reach third place. Third item is reach second place. But second place and third place is can't update. That is why?. Pleace help me...
Provide some code please.
https://github.com/htetzawphyo/Book-Shop/blob/main/app/Http/Controllers/Cart/CartController.php
I actually think your problem is here: https://github.com/htetzawphyo/Book-Shop/blob/main/resources/views/home/cartDetail.blade.php
and this onchange="autoSubmit()" in the form (one for each item). You see, you've declared it like:
function autoSubmit(){
document.forms['submit'].submit();
}
which I guess submits always the first form in the document. You could've easily known this, if you've debugged it a bit more, just put some
dd($request->all())
on starting of the updateCart method in the controller, start clicking and it'll reveal what you need to know.
Cheers
ok. thanks for your answer thank you very much