Jump to content
Latest News: (loading..)
tim_o_boy

Cart loses products seemingly randomly

Recommended Posts

Our shop has been happily running for around 13 years without many problems. However, occasionally products disappear from the cart as a customer goes around the site. This can be all the products in the cart or just one or two.

I've had a good search around but can't find anything quite like this. As it's seemingly random I can't reproduce it either. Just looking for any ideas if possible?

Share this post


Link to post
Share on other sites

13 years? If you're still using a 2005 vintage osCommerce (probably osC 2.2 MS2), it wouldn't be surprising if your host has upgraded PHP or made some other change that is making an old store unstable. What version are you using, and what is your host's PHP version? The current (and only supported) version of osC is 2.3.4.1BS "Frozen". Note that the official osC 2.3.4.1 release does not work with current PHP releases.


If you are running the "official" osC 2.3.4 or 2.3.4.1 download, your installation is obsolete! Get (stable) Frozen or (unstable) Edge. See also the naming convention and the latest community-supported responsive "Edge" release

Share this post


Link to post
Share on other sites
2 hours ago, tim_o_boy said:

However, occasionally products disappear from the cart as a customer goes around the site. This can be all the products in the cart or just one or two.

Question to be asked is it just customer error! I have had customers complain only to find they have removed the product and forgotten about it! I have also had customers put stuff in the cart and not check out, they come back latter and complain why is stuff in my cart! Well they left it in!

Unless you can replicate the problem you will never be able to pin it down. It could be something as simple as the session running out or it could just be customer error.


 

Share this post


Link to post
Share on other sites

Thanks for your replies!

From the start I began customising the system myself, taking all required elements from updates that my Frankenstein version required - mainly security related. Apart from this one strange quirk it works perfectly and processes around 20k orders a year without incident.

So I know some of you will be reluctant to offer any ideas as you have no idea of my code changes. All I can say is the coding of the cart is fundamentally what you work with. My changes are mainly UX related. So really I was just looking for pointers and ideally someone who may have seen the same problem.

The obvious thing is a problem with sessions but I'm not sure where, given the rare occurrence of it.

BTW, my partner who occasionally takes orders over the phone has had this happen to her too, so we can forget user error.

Share this post


Link to post
Share on other sites

i think this maybe a customers_id trouble.
shopping cart saved in every time into customers_basket table with logged in. when you find lost cart items it means that somebody delete items directly or data not saved into customers_basket.
it could be happen when customer press delete button directly. althought session is generated automatically there could be messed up protocols with mysql backend.
i think you have something not-well coding in shoppingCart class. there are reset() and cleanup() class functions with delete cart item commands.
i have found notes in shoppingCart class:

Quote

// reset per-session cart contents, but not the database contents

there are more possible way on code side to lose items even if you programming something different by your own way or add_cart() not end up here:

            $this->contents[$products_id_string] = array('qty' => (int)$qty);
// insert into database
            if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id_string) . "', '" . (int)$qty . "', '" . date('Ymd') . "')");

you might see that session contens is building before database saving. if datasave is not working then your partner step into the trouble.

if no time to close process on server (mysql server reset?) something not expected could be happen. maybe inno db engine could be more safety for this problem but i am not sure to solve it.
i have seen countless odd cases due to server side problems so this could be one of them.

finaly if your partner not logged in before session time out then the same could be happen.
 

Share this post


Link to post
Share on other sites

another problem could be the overloaded session. if you use mysql session then session size could be only max text field value. every overloaded data will be lost if owerflow happen

Share this post


Link to post
Share on other sites

Yeah, I'd check if current versions use a wider database field for session information than your (old) code does.

If you've been keeping up on changes for new PHP levels and security issues, you can keep running as you are, although the fact that you're having this cart problem suggests that you may be overlooking some changes. It may be time to step back and consider whether this is a good approach, as opposed to moving to the current release and building something resembling a template over it. Let others do the work of keeping up with the basics, while you concentrate on code to make your store stand out and improve the UX. It could well be less work overall to copy your changes to a new release than to constantly patch an old base. For example, did you do a lot for Responsive/Mobile-friendly? That's built right into "Frozen". What you have to keep in mind is that the longer you stay with an old, old base, the less help you can get from this forum and the more you're on your own. You've essentially made your own fork of the product.

Whichever way you choose to go, good luck and best wishes.


If you are running the "official" osC 2.3.4 or 2.3.4.1 download, your installation is obsolete! Get (stable) Frozen or (unstable) Edge. See also the naming convention and the latest community-supported responsive "Edge" release

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×