Deleting Old Carts

[COLOR=“Purple”]Instead of leaving old carts sitting there, is there a way to delete them ? I have a few test carts that have been there a couple months that I certainly don’t need clogging up the system :wink: [/COLOR]

Yes, only from the server side though. If you do not feel comfortable messing with the server side, then you need to ask your host to do it for you.

[COLOR=“Purple”]Thanks…that is what I needed to know[/COLOR] :smiley:

I can’t remember exactly how, but I was able to do this by deleting records within the database from myphp admin within Cpanel. Certainly do a backup before you delete anything. I imagine it would be very easy to royally screw things up.

[quote name=‘DawnG’][COLOR=“Purple”]Instead of leaving old carts sitting there, is there a way to delete them ? I have a few test carts that have been there a couple months that I certainly don’t need clogging up the system :wink: [/COLOR][/QUOTE]



So you know how to setup but you don’t know how to remove :slight_smile:

Can’t you clear the database tables?

Which tables do I empty? I want to get rid of the test carts before the site goes live.

The carts are stored in cscart_user_session_products.



Bob

There may be a misunderstanding here. I was under the assumption that the original poster had some old test sites.

Is there a way of clearing all carts from the admin?

If not what are the steps for doing this via phpmyadmin?



thanks

There is no way to do this in the Admin area.



If you want to drop all carts and wishlists, select your database in phpMyAdmin and then copy and past the following into the SQL tab:

TRUNCATE TABLE cscart_user_session_products



Bob

So, there’s no way to delete the user carts without deleting their wishlists? That’s not the best setup if that’s the case. I don’t think customers will be too happy if their wishlists are deleted but it would be good to delete the abandoned carts since they do pile up.

[quote name=‘scase’]So, there’s no way to delete the user carts without deleting their wishlists? That’s not the best setup if that’s the case. I don’t think customers will be too happy if their wishlists are deleted but it would be good to delete the abandoned carts since they do pile up.[/QUOTE]



If you want to delete just the carts, copy and paste the following into the SQL tab in phpMyAdmin:

DELETE FROM cscart_user_session_products WHERE type = 'C'



Bob

Thanks, Bob! I’ll give that a go…I appreciate the code since I’m not knowledgeable in SQL yet to figure that out.

If you know how to enter sql statements from phpmyadmin via your cpanel, this sql statement will delete all carts belonging to unregistered users. (Not that it does not delete carts by registered users, and does not delete any wishlist)



Delete
FROM `cscart_user_session_products`
WHERE `type` LIKE 'C'
AND `user_type` LIKE 'U'




As usual, advice is to backup your database before doing any changes directly to the database. ^^ Just in case you need to restore! ^^

Another possibility is to delete only carts older than some date. To do this, you will first need to convert your date to Unix time (you can use the converter at http://www.onlineconversion.com/unix_time.htm).



Then paste the following into the SQL tab in phpMyAdmin substituting your timestamp from above:

DELETE FROM cscart_user_session_products WHERE type = 'C' AND timestamp < '[B][COLOR="Red"]TIMESTAMP_FROM_ABOVE[/COLOR][/B]'



If you want to delete only the carts of unregistered user older than a certain date add the user_type to the WHERE clause:

DELETE FROM cscart_user_session_products WHERE type = 'C' AND timestamp < '[B][COLOR="Red"]TIMESTAMP_FROM_ABOVE[/COLOR][/B]' [B][COLOR="Blue"]AND user_type = 'U'[/COLOR][/B]



As nodame suggests, it is always smart to backup your table/database before making any changes.



Bob