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'] . "'");
}
Opencart Hosting Plans, Domain Registration, Microsoft and Google Email and More
Visit our website for great deals and most importantly, fast and friendly support - www.evolvewebhosting.com
where did you add that? That code would empty your cart immediately anytime the cart is loadedEvolveWebHosting 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'] . "'");
}
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.phpQphoria wrote:where did you add that? That code would empty your cart immediately anytime the cart is loadedEvolveWebHosting 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'] . "'");
}
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.
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.
Opencart Hosting Plans, Domain Registration, Microsoft and Google Email and More
Visit our website for great deals and most importantly, fast and friendly support - www.evolvewebhosting.com
not sure what line 330 is for you as that is the getTaxes function for me and that wouldn't make sense.
Q,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.
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!
Opencart Hosting Plans, Domain Registration, Microsoft and Google Email and More
Visit our website for great deals and most importantly, fast and friendly support - www.evolvewebhosting.com
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.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.
Opencart Hosting Plans, Domain Registration, Microsoft and Google Email and More
Visit our website for great deals and most importantly, fast and friendly support - www.evolvewebhosting.com
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.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 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()) . "'");
}
is there a fix simular tho the vqmod 1.5fix or does some1 have the code to fix ?
any help wll be great

Visit:www.websiteinc.co.uk - Email: Info@websiteinc.co.uk - Skype:websiteinc - Twiiter:@websiteinc - Facebook.com/websiteinc
Old Cart items retaining fix
http://www.opencart.com/index.php?route ... n_id=25558
Ernie
My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
Can anyone let me know which fix will work on 1.5.5.1 for the final Continue button problem?
Thanks!
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!
Users browsing this forum: Google [Bot] and 59 guests