Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Cloned Site - Clear Users And Orders Rate Topic   - - - - -


Posted 05 May 2021 - 08:44 AM #1


I am in the process upgrading the CS-Cart (CS-Cart 4.11.5).
I've created the copy of the site files and the clone of the database to different development server,
and everything is working fine.

I will have to delete all the customers and all the orders form the cloned site.
Is there a way to do it from the database?
I ask this because there is tens of thousands of customers and orders, and doing it manually from the backend will take forever.

Thank you :)

  • soft-solid
  • Junior Member
  • Authorized Reseller
  • Join Date: 19-Apr 10
  • 1435 posts

Posted 05 May 2021 - 09:30 AM #2



By deleting directly from the database you can forget about some tables and leave garbage behind.
It's best to write a simple script that will fetch all orders, users and loop them over, using the built-in functions fn_delete_order($order_id), fn_delete_user($user_id)
Best regards

Team of SoftSolid
cs-cart.pl, marketplace

We specialize in creating the highest quality addons, safe, useful and flexible

  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 21983 posts

Posted 05 May 2021 - 01:15 PM #3

Open the admin.php script and after the following line
require(dirname(__FILE__) . '/init.php');
$user_ids = db_get_fields("SELECT user_id FROM ?:users WHERE user_type = ?s", 'C');
if (!empty($user_ids)) {
foreach($user_ids as $uid) {

$order_ids = db_get_fields("SELECT order_id FROM ?:orders");
if (!empty($order_ids)) {
foreach($order_ids as $oid) {
Then go to any page in the admin panel to check the result
(!) Not tested

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)