Post by kelemvor » Fri Jan 15, 2016 11:15 am

Wow. 4 years later and still not fixed?

Active Member

Posts

Joined
Fri Oct 12, 2012 6:58 am

Post by EvolveWebHosting » Wed Mar 02, 2016 7:35 am

I added this to system/library/cart.php for v2.0.1.1 and it seems to be working so far.

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

Image
Take a close look at our domain pricing. It's cheaper than most of the 'big name' registrars.


User avatar
Active Member

Posts

Joined
Fri Mar 27, 2015 11:13 pm
Location - Denver, Colorado, USA

Post by Qphoria » Fri Mar 04, 2016 4:54 am

EvolveWebHosting wrote:I added this to system/library/cart.php for v2.0.1.1 and it seems to be working so far.

if (isset($this->session->data['customer_id'])) {
$this->db->query("UPDATE " . DB_PREFIX . "customer SET cart = '' WHERE customer_id = '" . (int)$this->session->data['customer_id'] . "'");
}
where did you add that? That code would empty your cart immediately anytime the cart is loaded
in 2.1.x it would delete the cart instantly and people would be confused why they click Add to cart and nothing gets added because it is being deleted immediately after.

There is no bug in OpenCart with this. If you are having this problem, it is either caused by payment configuration or another mod breaking the process and the customer never gets to the success page. The cart is cleared ON the success page, if you don't make it there, something else is causing that and there are no known bugs causing that.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by EvolveWebHosting » Fri Mar 04, 2016 6:56 am

Qphoria wrote:
EvolveWebHosting wrote:I added this to system/library/cart.php for v2.0.1.1 and it seems to be working so far.

if (isset($this->session->data['customer_id'])) {
$this->db->query("UPDATE " . DB_PREFIX . "customer SET cart = '' WHERE customer_id = '" . (int)$this->session->data['customer_id'] . "'");
}
where did you add that? That code would empty your cart immediately anytime the cart is loaded
in 2.1.x it would delete the cart instantly and people would be confused why they click Add to cart and nothing gets added because it is being deleted immediately after.

There is no bug in OpenCart with this. If you are having this problem, it is either caused by payment configuration or another mod breaking the process and the customer never gets to the success page. The cart is cleared ON the success page, if you don't make it there, something else is causing that and there are no known bugs causing that.
I added the code right after line 330 in system/library/cart.php

It is not emptying the cart as soon as something is added and the site has been receiving orders for the past few days since the code was added.

The site uses PP Standard and a payment module that was newly created. At first, I thought it was the new payment module but then noticed it was happening with Paypal as well. The theme could be the issue. I haven't ruled anything out.

If it's an issue of not making it to the success page, I've got a lot more research to figure out why some customers are making there and others aren't.

Image
Take a close look at our domain pricing. It's cheaper than most of the 'big name' registrars.


User avatar
Active Member

Posts

Joined
Fri Mar 27, 2015 11:13 pm
Location - Denver, Colorado, USA

Post by Qphoria » Sat Mar 05, 2016 11:35 pm

Not likely theme related but if all payments are experiencing it then it could be an order completion problem caused by a vQmod or ocmod. Common mods that cause this are like enhanced email mods or mods that report order details to other sites. These types of mods add themselves right to the common order confirmation function so if there is an error caused, it stops all order finalization.

not sure what line 330 is for you as that is the getTaxes function for me and that wouldn't make sense.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by EvolveWebHosting » Sun Mar 06, 2016 12:11 am

Qphoria wrote:Not likely theme related but if all payments are experiencing it then it could be an order completion problem caused by a vQmod or ocmod. Common mods that cause this are like enhanced email mods or mods that report order details to other sites. These types of mods add themselves right to the common order confirmation function so if there is an error caused, it stops all order finalization.

not sure what line 330 is for you as that is the getTaxes function for me and that wouldn't make sense.
Q,
Thanks for taking the time to write back about this. This is what I have from line 329 - 338:
public function clear() {
$this->data = array();

// Added 02/29/16 for potential cart fix
if (isset($this->session->data['customer_id'])) {
$this->db->query("UPDATE " . DB_PREFIX . "customer SET cart = '' WHERE customer_id = '" . (int)$this->session->data['customer_id'] . "'");
}

$this->session->data['cart'] = array();
}


The site uses Birthday Reminder and Signup Coupons from iSenseLabs and New Returns Email from OpencartX

I have usually had good experiences with both of these developers but anything is possible.

Thanks again for taking the time!

Image
Take a close look at our domain pricing. It's cheaper than most of the 'big name' registrars.


User avatar
Active Member

Posts

Joined
Fri Mar 27, 2015 11:13 pm
Location - Denver, Colorado, USA

Post by Qphoria » Sun Mar 06, 2016 6:07 am

Well it's basically 6 vs half-dozen.. That change actually clear their saved cart and in versions that have the "Login as this customer" feature from the admin will actually cause the customer's saved cart to clear.

Here is the flow:
Checkout->pay->success page
The success page calls that system library "clear()" function and clears the cart.
The cart class itself calls the update db cart when the session is cleared.

So calling it there is a bandaid which clears the cart on login to mask the problem. But the real underlying problem is that the success step isn't getting called correctly.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by EvolveWebHosting » Sun Mar 06, 2016 6:24 am

Qphoria wrote:Well it's basically 6 vs half-dozen.. That change actually clear their saved cart and in versions that have the "Login as this customer" feature from the admin will actually cause the customer's saved cart to clear.

Here is the flow:
Checkout->pay->success page
The success page calls that system library "clear()" function and clears the cart.
The cart class itself calls the update db cart when the session is cleared.

So calling it there is a bandaid which clears the cart on login to mask the problem. But the real underlying problem is that the success step isn't getting called correctly.
So you're thinking the payment gateway(s) is the issue? I know it's hard to judge for sure without seeing the entire site.

Image
Take a close look at our domain pricing. It's cheaper than most of the 'big name' registrars.


User avatar
Active Member

Posts

Joined
Fri Mar 27, 2015 11:13 pm
Location - Denver, Colorado, USA

Post by Qphoria » Wed Mar 09, 2016 3:55 am

Either paypal isn't setup to auto-return
or
another mod that alters the checkout confirm process is breaking and causing the completion process to fail

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by DECEiFER » Wed Apr 13, 2016 1:24 am

Qphoria wrote:Well it's basically 6 vs half-dozen.. That change actually clear their saved cart and in versions that have the "Login as this customer" feature from the admin will actually cause the customer's saved cart to clear.

Here is the flow:
Checkout->pay->success page
The success page calls that system library "clear()" function and clears the cart.
The cart class itself calls the update db cart when the session is cleared.

So calling it there is a bandaid which clears the cart on login to mask the problem. But the real underlying problem is that the success step isn't getting called correctly.
I had a client report that its customers were seeing their previous orders show up in their carts again on 1.5.3.1`and upon investigation I saw that the cart was not clearing in the database unless the "Continue" or other link was clicked on the success page. I confirmed this was also the case on a new install of 1.5.6.4, which has no mods and is completely stock. The vQmod that adds the db query to clear the cart solves the issue - thank you rph for doing the legwork of finding the issue.

So I'm not seeing where your statement saying "The cart class itself calls the update db cart when the session is cleared" is actually happening automatically without any further user action on the success page. I have the db open and I can tell when the cart is cleared and it certainly isn't happening like you're saying it is and the system Cart class doesn't have anything regarding the cart field in the db in 1.5.x or 2.0.x. I haven't checked anything later than 2.0.x.

As for the payment method - I used "Cash on Delivery" as the client uses that method exclusively, as they invoice their customers directly after a month or so and I did the same on my test site as it's the easiest way to get through the checkout process. I haven't tested another method that requires actual money to be taken in order to get to the success page, like PayPal, etc., though I suppose I could do a 1c item or something like that. However, full disclosure, "Cash on Delivery" is what applies in this case anyway and it's what I based my findings on.

So the vQmod that adds the query to the clear() function is the only thing that actually clears the db cart for the customer upon arrival to (not departure from) the success page.

But if you think we're missing something, please elaborate on the statement above, as I'm quite curious about it: "The cart class itself calls the update db cart when the session is cleared."


EDIT: I see from 2.1.0.1 on there's a new clear() function.

Code: Select all

public function clear() {
		$this->db->query("DELETE FROM " . DB_PREFIX . "cart WHERE customer_id = '" . (int)$this->customer->getId() . "' AND session_id = '" . $this->db->escape($this->session->getId()) . "'");
	}
Problem solved on arrival to the success page if you're able to upgrade to that version. Else the vQmod posted by rph seems to solve my issue on both 1.5.3.1 and 1.5.6.4, and there's no reason why 2.0.x.x shouldn't benefit from it either as the query still points to the correct table and field and the clear() function is almost identical with the two existing lines merely inverted, and I presume that "$this->session->data['customer_id']" still applies to getting the customer ID as well, as it does in both 1.5.3.1 and 1.5.6.4.

Newbie

Posts

Joined
Mon Feb 17, 2014 10:29 pm

Post by Websiteinc » Mon Oct 10, 2016 7:18 pm

i have cart not clearing after order on oc 2.0.1.1 using both paypal and cash on delivery .

is there a fix simular tho the vqmod 1.5fix or does some1 have the code to fix ?

any help wll be great :) reply or email iankibb88@gmail.com

Visit:www.websiteinc.co.uk - Email: Info@websiteinc.co.uk - Skype:websiteinc - Twiiter:@websiteinc - Facebook.com/websiteinc


User avatar
New member

Posts

Joined
Fri Sep 28, 2012 8:26 pm


Post by IP_CAM » Mon Oct 10, 2016 7:51 pm

this here could probably do:
Old Cart items retaining fix
http://www.opencart.com/index.php?route ... n_id=25558

Ernie

Please don't send me OC Forum Personal Messages, just contact: jti@jacob.ch
---
OC 1.5.6.5 LIGHT Test Site: http://www.bigmax.ch/shop/
OC 1.5.6.5 V-PRO Test Site: http://www.jacob.ch/shop/
My Github OC Site: https://github.com/IP-CAM
2'600+ FREE OC Extensions on the World's largest Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by kelemvor » Thu Oct 27, 2016 6:22 am

Sorry to bump this old thread but I'm on 1.5.5.1. I'm NOT having the Paypal related issue, I'm having the issue where if you go all the way through but close your browser before clicking the last Continue button the cart doesn't empty. I saw a vqmod posted on the first page but people said it didn't work on 1.5.5.1. I then saw other fixes but they all seemed specifically about paypal.

Can anyone let me know which fix will work on 1.5.5.1 for the final Continue button problem?

Thanks!

Active Member

Posts

Joined
Fri Oct 12, 2012 6:58 am

Post by kelemvor » Thu Oct 27, 2016 6:30 am

Well, never mind. I used the vqmod from rph and it does seem to work. Maybe the person who said it didn't was having the paypal issues instead.

Thanks.

Active Member

Posts

Joined
Fri Oct 12, 2012 6:58 am

Post by kbailie » Wed Sep 06, 2017 10:59 am

Can someone confirm if rph's fix will resolve the following systems --

1. customer placed an order and there was no problem.
2. months later they return and order new items
3. THEIR cart view looks fine and it only shows the NEW items they are ordering.
4. however when they go through the checkout process at some point old items from a PREVIOUS order get added to the new order and they obviously get charged and shipped something they didn't want.

So the cart is empty from the customer point of view but it appears old items were lingering in opencart's database perhaps and not properly cleared -- is there a fix for this in 1.5.3.1?

thanks!

Newbie

Posts

Joined
Sat Apr 27, 2013 12:59 am
Who is online

Users browsing this forum: No registered users and 54 guests