In the older version of Opencart, I remember being able to do this from Admin but seems not with OC3
Any advice would be very much appreciated
In the file catalog/controller/account/login.php
Find the line:
Code: Select all
if ($customer_info && $this->customer->login($customer_info['email'], '', true)) {
Code: Select all
$this->db->query("DELETE FROM " . DB_PREFIX . "cart WHERE customer_id = '" . (int)$this->customer->getId() . "'");
XForm - Opencart Form Builder
Xshippingpro - An advanced Shipping Module
Need Professional support? Skype: opencartmart
Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com
Therefore, changes to the login.php file is also not required as an event file could rather be set for those types of requests.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
The server therefore does not know whether a user has left the site or not.
Users can only explicitly invalidate their session by closing their browser (invalidating their session cookies) or delete their cookies manually.
The current code for cleaning guest carts is rather stupid and rude as it removes items 1 hour after they are added to the cart regardless of whether the session is still active. So a guest could be spending over an hour on the site when suddenly items from his cart start to disappear one by one.
A check on whether the session is still valid would be nice.
however, if you want to treat registered customers in the same way, just adjust the guest cart removal condition from
Code: Select all
$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: Select all
$this->db->query("DELETE FROM " . DB_PREFIX . "cart WHERE date_added < DATE_SUB(NOW(), INTERVAL 1 HOUR)");
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
Can I ask why?
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
The Github codes has been recently patched regarding those events. In the stable release of OC, that is correct, the expiry length of the time period has not been validated with the session handler library namespaces when using the file method rather than the database method. See this commit for more info: https://github.com/opencart/opencart/issues/7787The current code for cleaning guest carts is rather stupid and rude as it removes items 1 hour after they are added to the cart regardless of whether the session is still active.
This should resolved the issue after implementing the fix and clearing the browser's cache.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Due to the number of customers coming back at a later time and add items to their cart and when they go to checkout the older products are still in the cart, feedback is that customers are finding this a put off.
that is not what I meant and has no relation to the issue.the expiry length of the time period has not been validated with the session handler library namespaces when using the file method rather than the database method
The issue is that each item is removed from the guest cart 1 hour after it was added regardless of whether the session is still active.
This means that when a guest adds a product to the cart, stays longer than 1 hour, that item is removed while the guest is still on site.
I am saying, before removing items which were added an hour ago, also check if the session is no longer active, i.e. the session file is not there or the session record in the DB is not there because then you are certain the guest has left the building.
Better still, forget the hour mark and do that house-keeping in a scheduled job (not on every page load via the cart class) and simply remove all guest cart items for which the session has expired.
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
Even there, that may be inaccurate to validate due to server-specifics settings. Which is why, the cart is being cleared by time interval rather than its session since the session from the cart also gets deleted despite of the defined time period in the library. It is just unfortunate, in a sense, that the time period itself is defined as a static way to get rid of only one problem in the end.Better still, forget the hour mark and do that house-keeping in a scheduled job (not on every page load via the cart class) and simply remove all guest cart items for which the session has expired.
At least, on Github, there's a fix to validate the time-to-live for the session that resolves most of these issues.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
No it isn't, if the session file or record is removed by system session garbage-collection, then (and only then) is the session dead, that is the only time the server knows for certain the client has left. That the client may have left before that is irrelevant.Even there, that may be inaccurate to validate due to server-specifics settings
It is the same as with other cart systems where the cart content is stored in client session cookies, when the session expires, the cookie with it contents is gone.
With OC you store the cart content in the database so you have to clean that yourself when the session has expired.
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
https://www.opencart.com/index.php?rout ... n_id=40961
Izdelava spletne trgovine | Najem spletne trgovine | PHP programiranje
Users browsing this forum: No registered users and 416 guests