Can't adjust qty or remove first item in the cart
Moderator: General Moderators
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Can't adjust qty or remove first item in the cart
I tried to experiment with it on the site, but it won't add any items to the cart.
Re: Can't adjust qty or remove first item in the cart
That is strange...I just tried the site and it was adding items to the cart. Do I maybe have a few bugs in the cart code?
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Can't adjust qty or remove first item in the cart
Looks like you're using $_POST when you're supposed to be using $_GET in your code to add items to the cart.
Re: Can't adjust qty or remove first item in the cart
Ok, so now when i add items to the cart it does the following (after changing $_POST to $GET):
It adds the first item with a quantity of 1, the second with a quantity of 3, the third with a quantity of 3, the fourth with a quantity of 3. When I try to adjust the quantity of the second item, the quantity of the first item goes to 5. When the quantity is set to 0 it will remove the item, except the first item in the cart.
So, it's not adjusting the quantities properly or putting the correct quanitity in the cart when the item is added.
It adds the first item with a quantity of 1, the second with a quantity of 3, the third with a quantity of 3, the fourth with a quantity of 3. When I try to adjust the quantity of the second item, the quantity of the first item goes to 5. When the quantity is set to 0 it will remove the item, except the first item in the cart.
So, it's not adjusting the quantities properly or putting the correct quanitity in the cart when the item is added.
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Can't adjust qty or remove first item in the cart
Still won't add items to the cart. Go here:
http://coppercreekbathandbody.ca/cart.p ... scent=0032
Despite multiple refreshes, it states that the cart is empty.
http://coppercreekbathandbody.ca/cart.p ... scent=0032
Despite multiple refreshes, it states that the cart is empty.
Re: Can't adjust qty or remove first item in the cart
Ok. I'm testing it on the localhost right now. that is where I'm getting those problems. I haven't reuploaded the recent changes to the website yet.
Re: Can't adjust qty or remove first item in the cart
Ok, so I uploaded the changes...it seems to add products to the cart without any problems, for me anyway. It still doesn't want to adjust the first item in the cart though.
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Can't adjust qty or remove first item in the cart
Alright, now items are added to the cart, but changing quantities doesn't work for any products, not just the first one. Change the submit link to a submit button (<input> with type "submit").
Re: Can't adjust qty or remove first item in the cart
That's weird because I can change the quantities of all items except the first. Is there another option, I'm trying to avoid the ugly submit button look. lol.
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Can't adjust qty or remove first item in the cart
If you want it to look better, style it with CSS. Just don't go down the Javascript road in this case.
Re: Can't adjust qty or remove first item in the cart
I have my update button like this:
When I click on the first item, it still won't adjust the quantity. It adjusts the quantity of the other items.
I haven't uploaded it to the webpage yet. I'm testing it in localhost.
When I click on the "update" button for the first item in the cart, the url turns to:
http://localhost/CopperCreek/cart.php?q ... ton=Update
Code: Select all
<input class=updateButton name=updateButton value=Update type=submit>
I haven't uploaded it to the webpage yet. I'm testing it in localhost.
When I click on the "update" button for the first item in the cart, the url turns to:
http://localhost/CopperCreek/cart.php?q ... ton=Update
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Can't adjust qty or remove first item in the cart
What does the URL say for the rest?
Re: Can't adjust qty or remove first item in the cart
So I did some playing around and if I change your code to adjust the item or remove the item from the cart from $_POST to $_GET, it will remove and change the quantity of the first item in the cart but not the other items. If I leave it as $_POST, it changes and removes all the items except the first item in the cart.
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Can't adjust qty or remove first item in the cart
It's a problem with the Javascript. Have you replaced the link with a submit button? It's still a link on the site.