Page 1 of 4

Cart items not clearing after checkout

Posted: Sat Sep 10, 2011 3:09 am
by fsgroup
We are having an issue with the contents of the shopping cart not being cleared after checkout. Here is the scenario.

As a registered customer, I complete an order for a single product. When finished, the shopping cart displays an empty message. I then start to order a different product and when I arrived at the Confirmation page during Checkout, both the product I am trying to order AND the previously ordered product are listed on my order.

I've seen a few similar posts, but no real solution was offered. Have other OpenCart users experienced this?

Thanks!

Re: Cart items not clearing after checkout

Posted: Sat Sep 10, 2011 4:45 am
by Qphoria
If a cart isn't being cleared that means the order confirmation process has failed somewhere. The failure can be due, but not limited to:
- Bug in the payment gateway callback process (very likely)
- Bug in the order confirm function (less likely)
- Bug in the order update function (less likely)
- Failure in the mail step of the confirm or update function (likely)

The payment extension is the last stop before the order gets confirmed. If the confirm doesn't finish properly, or if the confirm finishes but something broke on the final step of the payment callback, this is the usual reason for cart's not clearing. The cart clear function is called on the checkout/success page so if that page isn't reached, the cart will not clear, even if the order has been processed in the database.

What payment extension are you using?
Do you have any known email issues?

Re: Cart items not clearing after checkout

Posted: Sat Sep 10, 2011 5:02 am
by fsgroup
Thank you for the quick reply! We are using the Authorize.Net (AIM) payment method. We have not experienced any issues with email.

Re: Cart items not clearing after checkout

Posted: Tue Sep 13, 2011 1:40 am
by fsgroup
Hi Qphoria,

Do you have any thoughts knowing that we are using the Authorize.Net (AIM) payment module?

Thanks!

Re: Cart items not clearing after checkout

Posted: Wed Sep 14, 2011 2:40 am
by fsgroup
Does anyone else have experience with a problem like this? If it is indeed tied to the payment module what are the options for resolving it? Thanks!

Re: Cart items not clearing after checkout

Posted: Wed Sep 14, 2011 2:48 am
by Qphoria
fsgroup wrote:Hi Qphoria,

Do you have any thoughts knowing that we are using the Authorize.Net (AIM) payment module?

Thanks!
If its the AIM payment you should be getting some feedback from the page... the noted issue is typically that it just shows "Loading" and never finishes. Is that the case? I will add the improved error handling I added for 1.4.x to the 1.5.x payments that use curl... one popular cause for this was a curl error about ssl not being compiled with the curl extension.

Re: Cart items not clearing after checkout

Posted: Wed Sep 14, 2011 3:29 am
by fsgroup
We are not seeing anything like the order not finishing. Since we are also not having issue with receiving the email confirmations of orders does that mean that we are left with:
- Bug in the order confirm function (less likely)
- Bug in the order update function (less likely)
This is resulting in many clients cancelling their order, calling in after seeing the issue, or ordering more products than they intended so any further ideas would be great as we need to find a fix quickly.

Thanks!

Re: Cart items not clearing after checkout

Posted: Fri Oct 21, 2011 8:27 pm
by onlinephilately
Hi

I am having a similar problem (v1.5.1).

The order is sent to the database and the e-mail is sent to the customer.

But some times the cart is not cleared. This is not happening every time so it must be somewhere along the lines that the page is not fully loaded.

This also creates a problem the next time a customer logs in and the cart is not cleared. It then seems to hang the site.

Any hints or help is appreciated.

Re: Cart items not clearing after checkout

Posted: Tue Jul 10, 2012 4:42 pm
by webberley
OpenCart 1.5.2.1 with cash on delivery has this problem too. ALL my customers are set Cash on Delivery, and SOME people have the above issue where opencart decides to add last times cart to their order. So the bug has nothing to do with external payment providers, 100% in the OC coding. Anybody found a workaround for this? as it doen't look likes it's going to be fixed sadly.

Re: Cart items not clearing after checkout

Posted: Tue Jul 17, 2012 1:40 pm
by onlinephilately
We also have COD as the main payment option and it seems to be happening when a customer places an order and leave the computer on checkout_success.

If the checkout_success is left (i.e. to home) the cart seems to clear.

This is annoying for us as most of our products are unique (only one).

Re: Cart items not clearing after checkout

Posted: Sat Aug 25, 2012 2:11 am
by rph
Did some digging. This is caused by the customer not hitting the continue button on the order success screen and could be considered a "bug" with OpenCart.

What's happening is the success controller is properly clearing out the cart data in the session. It's still in the customer database though in the cart column. OpenCart updates this info based on the current cart session but if the customer doesn't go to anther page on your website after completing the order (e.g. they close the browser) that database cart info won't be cleared out.

EDIT: Added a VQMod bug fix. This is only tested lightly on 1.5.4.1 and 1.5.1.3 so use with caution.

Re: Cart items not clearing after checkout

Posted: Mon Oct 22, 2012 8:42 pm
by nikythebest
Hello,

I have the same problem. I am using 1.5.1.2 Only Cash on delivery as a payment method. The cart is not clearing after the order is finished. Can anyone help us? I tried your VQMOD but still have the same problem.

Thank you

Re: Cart items not clearing after checkout

Posted: Wed Oct 31, 2012 3:10 am
by aboss3
Was anyone ever able to fix it?

Re: Cart items not clearing after checkout

Posted: Wed Oct 31, 2012 9:09 pm
by rph
I released a VQMod to fix the bug I described. If you hit 'Continue' on the success page but the cart is still full after then you have some other issue.

Re: Cart items not clearing after checkout

Posted: Fri Nov 02, 2012 6:22 am
by jty
rph wrote:Did some digging. This is caused by the customer not hitting the continue button on the order success screen and could be considered a "bug" with OpenCart.

What's happening is the success controller is properly clearing out the cart data in the session. It's still in the customer database though in the cart column. OpenCart updates this info based on the current cart session but if the customer doesn't go to anther page on your website after completing the order (e.g. they close the browser) that database cart info won't be cleared out.
Bug confirmed. This bug has been annoying me for a very long time. I finally put the night aside last night to methodically hunt it down, only to come here later and find that rph had already found it.

I discovered the same as rph - when the buyer closes the browser after checkout/success without clicking on any other link on the site, the cart is not cleared "from the database".

checkout/success clears the cart from "the sesssion" but not the database. The buyer needs to press another link on the site to write the empty session cart to the database, thereby clearing the cart from the database.

My solution was similar to rph's ie. update the customer cart field, except I did it in the checkout/success file.

Thanks rph for posting your findings. Shame I didn't find your post before I wasted the night ::)

PS - if rph's solution doesn't help you, checkout Qphoria's post above.

Re: Cart items not clearing after checkout

Posted: Sun Nov 18, 2012 5:27 pm
by madimar
Great! Thanks guys! You solved a long time issue I had.

M

Re: Cart items not clearing after checkout

Posted: Wed Mar 13, 2013 8:50 am
by pedro1993
Thanks for the fix! I was able to help a client of mine with this! Great job

Re: Cart items not clearing after checkout

Posted: Tue Mar 19, 2013 1:34 pm
by storm-cloud
rph wrote:Added a VQMod bug fix. This is only tested lightly on 1.5.4.1 and 1.5.1.3 so use with caution.
Excellent work rph!

Is there ANY risk at all using this modification? You mentioned to use this with caution. Is there any possibility that this could cause any adverse effects such as clearing the cart in other (unwanted) circumstances?
jty wrote:My solution was similar to rph's ie. update the customer cart field, except I did it in the checkout/success file.
Is there any advantage in using this method as opposed to rph's? Could you elaborate on the exact changes required?

Re: Cart items not clearing after checkout

Posted: Wed Mar 20, 2013 3:23 am
by rph
storm-cloud wrote:Excellent work rph!

Is there ANY risk at all using this modification? You mentioned to use this with caution. Is there any possibility that this could cause any adverse effects such as clearing the cart in other (unwanted) circumstances?
Shouldn't but I haven't tested anything.

Re: Cart items not clearing after checkout

Posted: Fri Apr 19, 2013 11:13 am
by choccybox
Have the same problem of carts not clearing when customers return from paypal, so want to try the above vqmod, but has it been tested on V1.5.5.1? Or does anybody know whether it works on v1.5.5.1?

Thanks!