Customer creates and account, logs in and browses the store adding some items to their cart. Not ready to buy yet so they close browser and eventually get logged out so a day or two later, they visit the store and see the items are not in their cart so they add them to the GUEST CART and then when they are ready to check out, they have to log in and don't realize that the store adds the items in their guest cart to the items in their actual cart! Customers being customers fail to review cart and check out with duplicate items in their cart and then we have extra work to confirm that they did or didn't want duplicate items!
Is there anyway to avoid this? Maybe keep customers logged in for days or longer? I need to find a solution for this!! Thanks!
It's a 3.0.3.8 shop install
OpenCart 3.0.3.8
www.wattstruckcenter.com/shop
viewtopic.php?t=211273
https://github.com/opencart/opencart/issues/7375
OpenCart 3.0.3.8
www.wattstruckcenter.com/shop
There are a few suggestions on this forum that may help. There are also some extensions in the marketplace that may also help.
David C.
I wonder if the sun is shining outside?
There is no OC 3.4, to start with. Please provide exact details if you want help here and think there is a bug beyond the fact that OpenCart remembers the shopping cart of a customer.calderwood wrote: ↑Fri Apr 11, 2025 10:06 amI've been having the same issue with multiple double orders in the cart. Running v3.4
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
Yes I think there are extensions and forum posts about this. Did you search first before posting?rocketfoot wrote: ↑Thu Apr 10, 2025 9:41 pmIs there anyway to avoid this? Maybe keep customers logged in for days or longer? I need to find a solution for this!! Thanks!
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
https://www.opencart.com/index.php?rout ... n_id=46062
OpenCart 3.0.3.8
www.wattstruckcenter.com/shop
Its not about being logged in for a longer period of time, it is about that the merging of saved and current cart content for a user is done in the construct of the cart class by default. That is construct is executed on every request, where the cart class is instantiated, including every ajax call. That causes problems. So the solution is to get that merging out of that construct and only execute it when required, registration (and subsequent login) and regular login.rocketfoot wrote: ↑Fri Apr 11, 2025 5:53 pmI have added an extension that keeps the customer logged in for a longer period to hopefully prevent some of this...but now a customer just emailed me saying that he clicked on our store site and when he checked his account, he noticed that it was completely someone else's account! He logged out and back in and all seems fine! I hope this new extension isn't going to be problematic! This is what I added:
https://www.opencart.com/index.php?rout ... n_id=46062
I'm just going to have to try and train customers to double check their orders before the submit them!
OpenCart 3.0.3.8
www.wattstruckcenter.com/shop
The big question is...how can I fix it? I am still getting constant duplicate orders!nonnedelectari wrote: ↑Fri Apr 11, 2025 7:44 pmIts not about being logged in for a longer period of time, it is about that the merging of saved and current cart content for a user is done in the construct of the cart class by default. That is construct is executed on every request, where the cart class is instantiated, including every ajax call. That causes problems. So the solution is to get that merging out of that construct and only execute it when required, registration (and subsequent login) and regular login.rocketfoot wrote: ↑Fri Apr 11, 2025 5:53 pmI have added an extension that keeps the customer logged in for a longer period to hopefully prevent some of this...but now a customer just emailed me saying that he clicked on our store site and when he checked his account, he noticed that it was completely someone else's account! He logged out and back in and all seems fine! I hope this new extension isn't going to be problematic! This is what I added:
https://www.opencart.com/index.php?rout ... n_id=46062
OpenCart 3.0.3.8
www.wattstruckcenter.com/shop
If you're not having much luck here, you could pay a developer such as ourselves or post a job in the Commercial Support Forum.rocketfoot wrote: ↑Wed May 14, 2025 1:50 amThe big question is...how can I fix it? I am still getting constant duplicate orders!
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
Code: Select all
$this->db->query("UPDATE " . DB_PREFIX . "cart SET session_id = '" . $this->db->escape($this->session->getId()) . "' WHERE api_id = '0' AND customer_id = '" . (int)$this->customer->getId() . "'");
You may be best to get a developer to take a look at what is happening.
Code: Select all
// Remove all the expired carts with no customer ID
$this->db->query("DELETE FROM " . DB_PREFIX . "cart WHERE (api_id > '0' OR customer_id = '0') AND date_added < DATE_SUB(NOW(), INTERVAL 1 HOUR)");
[code]
to this:
[code]
// Remove all expired cart items
$this->db->query("DELETE FROM " . DB_PREFIX . "cart WHERE date_added < DATE_SUB(NOW(), INTERVAL 1 HOUR)");
and comment out this:
Code: Select all
// We want to change the session ID on all the old items in the customers cart
$this->db->query("UPDATE " . DB_PREFIX . "cart SET session_id = '" . $this->db->escape($this->session->getId()) . "' WHERE api_id = '0' AND customer_id = '" . (int)$this->customer->getId() . "'");
items which were added by a client as guest prior to signing in will still be retained as they are session bound.
Users browsing this forum: Amazon [Bot], Google [Bot], maffe, Semrush [Bot] and 52 guests