Jump to content

Basket Randomly Emptying & saved_cart BLOB Recover


Recommended Posts

Hello again all...  Got another odd one in 2 parts.  Let me start with the last first:


Cubecart: Current as of today

PHP v 5.6.37


  1. Recovering a basket from a saved cart blob (database). 
    DETAILS:  A customer was building an order in their basket over the last couple days.  Today they logged in to find their basket emptied.  The order was not placed nor was the basket emptied.  Oddly I can see the order in the cubecart_saved_cart table in the database which is contained in the blob file. 

    I am 100% at a loss for how it can be here with the proper customer ID associated with it yet not show in their basket.  

    Any ideas on how to get this to show or "restore" this to their basket?
  2. Random empty baskets (Directly related to #1)
    Background:  Our customers tend to build orders over the course of days/weeks. They rely on the previous selections remaining in their basket to build their order over time.  

    DETAILS:  Over the last year we have the occasional customer complain their cart has emptied.   It has spread over 10-15 customers with the occasional repeat.  Baskets have been being built anywhere from the day before to a couple of weeks.  The timeout and cookie kill has been set from 1 week to a month trying to diagnose this problem (all the noted empty occurrences have happened within these time frames)

    Anyone have something similar happening or any guesses as to what it might be?  I have kind of run through my skill level of options and come up blank?


Link to post
Share on other sites

Thanks for the fast response Noodleman (love several of your plugins btw)

Not as far as I know but unfortunately I was not here for the initial building of this site.  I can say there are no current modules like that in place and I am assuming the  "cubecart_saved_cart"  is stock to cubecart.

Link to post
Share on other sites

You can also try to change the session settings for your account (if you are allowed to by your hosting company).

Try doing the following (assumption made that you are hosted on a cPanel based system)

1) Create a new directory above the public_html directory called "sessions"

2) Change "session.save_path" in your php.ini file to point to this new session directory instead of the default one for your PHP version

3) Change "session.gc_maxlifetime" to something like 172800 (2 days in seconds) rather than the default session lifetime of 1440 (24 minutes)

We do this for all clients on our fully managed hosting plans and solves the problem.  BTW the Abandoned Carts Module is still useful for catching and converting visitors that started to build an order and left before completing it


Link to post
Share on other sites

Afternoon, that rules out my initial thought. The module I mentioned may, under some rare scenarios do similar to what you have described. 

The recall of the cart (if in CubeCart_saved_cart) is reasonably simple. however it does have a dependency on the customer session data still existing on the server. perhaps your web server is clearing session files/content on a schedule. most servers do it on a re-boot, some scheduled etc. I think that may explain the issue.

Link to post
Share on other sites
7 minutes ago, Noodleman said:

perhaps your web server is clearing session files/content on a schedule. most servers do it on a re-boot, some scheduled etc. I think that may explain the issue.

The standard behaviour is to set the session save path to a fixed path per PHP version (so all users on that same version of PHP use the same path) and set the gc_maxlifetime to 24 minutes and while garbage collection is a fuzzy concept, potentially a session can be considered stale and deleted after 24 minutes.  This explains why you have an item in the saved_cart table but the customer cannot see it

Link to post
Share on other sites

Thanks Ian (another fan of your plugins btw) and Noodleman 


Ian, I tried looking for the php.ini in the impacted directories but there are none in any of the sites we have that use cubecart.  However, I am seeing a  ini-custom.inc.php  which seems to be doing what I normally see a php.ini do.


upload_max_filesize = 12M
post_max_size = 13M
memory_limit = 15M

Would your save path redirect work there?

I can see no reason not to try a php.ini in the public directory so I am testing it but not getting any population in the sessions directory. 


Does the above seem right?



Link to post
Share on other sites

If you are running cPanel AND your hosting companies allows you access to Multi PHP INI Editor AND you are allowed by them to change the values - that is by far the best way of doing it.  Once you have changed it, then go into PHP Info and go to the sessions section and check that it has changed

If your statement in your last post of the setting of your memory_limit at 15M is correct and it isnt a typo, then you need to change or better still remove that line !

Link to post
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...