Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Cart Error When Update Only Work First Item #348

Open
htetzawphyo opened this issue Oct 29, 2022 · 4 comments
Open

Update Cart Error When Update Only Work First Item #348

htetzawphyo opened this issue Oct 29, 2022 · 4 comments

Comments

@htetzawphyo
Copy link

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...

@Blum
Copy link

Blum commented Oct 31, 2022

Provide some code please.

@Blum
Copy link

Blum commented Nov 3, 2022

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

@htetzawphyo
Copy link
Author

ok. thanks for your answer
thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants