Post by rph » Sat Apr 20, 2013 4:59 am

It won't hurt anything to try it.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by choccybox » Thu Apr 25, 2013 8:38 pm

Tried this in V1.5.5.1 and it is not working for us. Customers carts are still not emptying after returning from paypal and then closing the success page without logging out or going to another page.

Any ideas?

Newbie

Posts

Joined
Wed Oct 31, 2012 8:08 pm

Post by rph » Sun Apr 28, 2013 12:38 am

You can purchase commercial support following the link in my signature.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by choccybox » Sun May 05, 2013 8:38 pm

This problem to me is a bug in opencart that should be fix.

I've been monitoring this the last couple of weeks and there are two situations that cause the cart not to clear.

1. The customer pays at paypal by credit card and is never redirected back to the website success page at all. Why they are not redirect back to the success page I do not know.

2. The customer pays through their paypal account. When they finish the transaction through their paypal account it appears they DO get sent back to the website success page. However, customers that close the success page without logging out or clicking onto any other page on the website do not have their carts cleared.

These are the two situations where carts do not clear. This is obviously a bug, and the previous vqmod uploaded to this topic doesn't work for v1.5.5.1.

Newbie

Posts

Joined
Wed Oct 31, 2012 8:08 pm

Post by rph » Mon May 06, 2013 12:50 am

It's important to remember OpenCart is free software built on thousands of hours of work contributed by volunteers. As an ecommerce solution it is more robust and powerful than packages that cost hundreds and thousands of dollars. No one who uses it is owed anything. Instead it is up to everyone to contribute to the project to make it better.

PayPal checkout is a highly used area of the cart. A problem like you described would either be a rare edge case in the core, the result of third-party modification, or a misunderstanding of some underlying issue. A developer could try to guess at this all day and never get anywhere but as the operator of your website you should attempt to either locate the source of the issue in the code yourself or hire a developer who can then contribute the solution back to the community, if applicable.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by grgr » Mon May 06, 2013 2:09 am

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.

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.
Surely this bit of code would be better off in ModelCheckoutOrder::Confirm?

That way, even if the customer does not return to the site (a good number of payment methods allow this - i.e. no automatic redirection after payment) then the cart will get cleared anyway.

Code: Select all

if ($order_info['customer_id']) {
     $this->db->query("UPDATE " . DB_PREFIX . "customer SET cart = '' WHERE customer_id = '" . (int)$order_info['customer_id' . "'");
}
Just a thought, I am potentially just being really dim and missing something obvious though. It's been a sunny day and it might have addled my brain.

Image Image Image Image Image Image Image Image


User avatar
Active Member

Posts

Joined
Mon Mar 28, 2011 4:08 pm
Location - UK

Post by rph » Mon May 06, 2013 2:58 am

It wouldn't hurt but the cart would just end up repopulated anyway if $this->cart->clear() wasn't being called.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by srunyon1 » Fri May 24, 2013 7:18 am

I've been struggling with something almost the same ,
but it only happens when using Pay Pal Pro.
the Transaction completes on Paypal, the Database gets updated with the transactions info, but the screen never goes to success. leaving the confirm button still there and if pressed again it will repeat the order.
I tried your fix, it did not help this.
I'm no 1.5.5.1 but I started getting this problem on 1.4.x.x
I upgraded to try and fix it. Strange too how this seemed to just start acting up.

Active Member

Posts

Joined
Thu Jan 28, 2010 3:03 pm

Post by straightlight » Fri May 24, 2013 10:46 am

Code: Select all

if ($order_info['customer_id']) {
     $this->db->query("UPDATE " . DB_PREFIX . "customer SET cart = '' WHERE customer_id = '" . (int)$order_info['customer_id' . "'");
}
for:

Code: Select all

if (!empty($order_info['customer_id'])) {
     $this->db->query("UPDATE `" . DB_PREFIX . "customer` SET `cart` = '' WHERE `customer_id` = '" . (int)$order_info['customer_id'] . "'");
}

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jfkansas » Sat Jun 22, 2013 5:16 am

I was having the same problem with PayPal Standard. After paying the user would need to click the Return to site link for the cart to clear. So looking through the source, found the link:

https://www.paypal.com/us/cgi-bin/merch ... d=_account

And put that in the auto return. Problem fixed. User doesn't have to click anything.

Newbie

Posts

Joined
Sat Jun 22, 2013 5:08 am

Post by mwd » Fri Aug 02, 2013 3:15 am

Having the same issue with Paypal standard.
I just finally narrowed it down to PP last night before finding this thread, and other fixes that didn't work.

Customer checks out at Paypal, and returns to site via link or auto-return = Cart cleared.
Customer checks out at Paypal, but closes browser after payment without returning = Cart not cleared.

IPN works to update order status and history, but does nothing for clearing the cart.

I found a site with a possible fix, but I haven't gotten it to work.
http://www.simonbattersby.com/blog/2013 ... ent-134699

If anyone gets a fix working and can explain it to us laymen (or post a VQmod) it would be greatly appreciated.

Use it? Like it? Want to support it but don't know how? Send a donation to show your appreciation.
Daniel's PayPal address - donate@opencart.com
Qphoria's Paypal address - qphoria@gmail.com


mwd
Active Member

Posts

Joined
Sat Jan 08, 2011 11:40 pm

Post by Qphoria » Fri Aug 02, 2013 8:27 pm

mwd wrote:Having the same issue with Paypal standard.
I just finally narrowed it down to PP last night before finding this thread, and other fixes that didn't work.

Customer checks out at Paypal, and returns to site via link or auto-return = Cart cleared.
Customer checks out at Paypal, but closes browser after payment without returning = Cart not cleared.

IPN works to update order status and history, but does nothing for clearing the cart.

I found a site with a possible fix, but I haven't gotten it to work.
http://www.simonbattersby.com/blog/2013 ... ent-134699

If anyone gets a fix working and can explain it to us laymen (or post a VQmod) it would be greatly appreciated.
You need to set your paypal account to "Auto-Return" instead of sitting on the paypal receipt page.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by mwd » Fri Aug 02, 2013 10:15 pm

Qphoria wrote:You need to set your paypal account to "Auto-Return" instead of sitting on the paypal receipt page.
Hi Q, Thanks for taking a look.
Auto-Return is already set to On, as is Payment Data Transfer.
The problem is that Paypal isn't immediately sending a customer back after hitting pay.
Instead they get an Auto-Return page that redirects them to the cart automatically after 10 seconds.
If the customer closes the browser thinking they're finished before the 10 seconds expires and sends them back to the cart, the cart doesn't clear.

Is there some other setting I'm missing that will avoid this?
Something that immediately sends them back without hitting that auto-return page first?

Use it? Like it? Want to support it but don't know how? Send a donation to show your appreciation.
Daniel's PayPal address - donate@opencart.com
Qphoria's Paypal address - qphoria@gmail.com


mwd
Active Member

Posts

Joined
Sat Jan 08, 2011 11:40 pm

Post by mwd » Fri Aug 02, 2013 10:18 pm

Should the Payment Data Transfer be set to On?

Use it? Like it? Want to support it but don't know how? Send a donation to show your appreciation.
Daniel's PayPal address - donate@opencart.com
Qphoria's Paypal address - qphoria@gmail.com


mwd
Active Member

Posts

Joined
Sat Jan 08, 2011 11:40 pm

Post by Qphoria » Sat Aug 03, 2013 2:43 am

mwd wrote:
Qphoria wrote:You need to set your paypal account to "Auto-Return" instead of sitting on the paypal receipt page.
Hi Q, Thanks for taking a look.
Auto-Return is already set to On, as is Payment Data Transfer.
The problem is that Paypal isn't immediately sending a customer back after hitting pay.
Instead they get an Auto-Return page that redirects them to the cart automatically after 10 seconds.
If the customer closes the browser thinking they're finished before the 10 seconds expires and sends them back to the cart, the cart doesn't clear.

Is there some other setting I'm missing that will avoid this?
Something that immediately sends them back without hitting that auto-return page first?
PDT isn't used but that wouldn't help you anyway in this case.
It is true, if they close their browser in the 10 sec window, then they will still have item in their cart. This is pretty much the case with most carts I believe... but i think the odds are slim that people will close before the redirect ... but perhaps it happens more often than I think. It may be possible to link the cart clear step to the ipn as a backup

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by mwd » Sat Aug 03, 2013 11:38 pm

Qphoria wrote:It may be possible to link the cart clear step to the ipn as a backup
That was my thought as well, and would be a nice VQmod I'd be willing to pay for if someone can figure out how to make it.
;)

Use it? Like it? Want to support it but don't know how? Send a donation to show your appreciation.
Daniel's PayPal address - donate@opencart.com
Qphoria's Paypal address - qphoria@gmail.com


mwd
Active Member

Posts

Joined
Sat Jan 08, 2011 11:40 pm

Post by Qphoria » Tue Aug 06, 2013 2:01 am

Try this... not tested but may work

1. EDIT: catalog/model/checkout/order.php

2. FIND (TWICE):

Code: Select all

$this->db->query("UPDATE `" . DB_PREFIX . "order` SET order_status_id
3. BEFORE, ADD:

Code: Select all

$this->db->query("UPDATE " . DB_PREFIX . "customer SET cart = '' WHERE customer_id = '" . (int)$order_info['customer_id'] . "'");

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Qphoria » Wed Aug 07, 2013 1:38 am

Any one try this yet?

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by mwd » Wed Aug 07, 2013 4:11 am

Hi Q,

I gave it a try without success, but we're in the middle of a server move from that whole EIG mess, so I can't be sure of where data is getting sent yet until all the DNS entries have updated.
I placed a few test orders using Paypal, and only one actually showed up in OC.
Once I'm sure everything is functioning correctly on the new server I'll give it a good testing.

Use it? Like it? Want to support it but don't know how? Send a donation to show your appreciation.
Daniel's PayPal address - donate@opencart.com
Qphoria's Paypal address - qphoria@gmail.com


mwd
Active Member

Posts

Joined
Sat Jan 08, 2011 11:40 pm

Post by Qphoria » Wed Aug 07, 2013 4:16 am

mwd wrote:Hi Q,

I gave it a try without success, but we're in the middle of a server move from that whole EIG mess, so I can't be sure of where data is getting sent yet until all the DNS entries have updated.
I placed a few test orders using Paypal, and only one actually showed up in OC.
Once I'm sure everything is functioning correctly on the new server I'll give it a good testing.
hmm they should all show up in OC... the fix I made is for auto-clearing the cart if you close the window before being sent back to the success page. Best way to test:
1. Login as a registered user
2. Add something to your cart
3. checkout with paypal
4. During the 5 sec auto-return countdown, close your browser
5. Open a new browser and log in with your account
6. See if the item is still in your cart

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am
Who is online

Users browsing this forum: No registered users and 44 guests