I have OpenCart v1.4.9.3 installed. I have an existing database. I am going to create a new database and new OpenCart install using an export of my existing database. I want to reset order, invoice, customer counters etc.
The only things that I want in my new database from my existing database are: (basically anything product related)
products
product descriptions
product catagories
product options
product images
product option images
product related
manufacturers
(I am sure there are more tables that need to be added to this product table list...)
I want to delete everything else in the database and reset all counters orders, invoices, customers, etc.
This is what I was planning on doing.... is this right?
1) Export existing database using PHP Admin
2) Import existing database to new database using PHP Admin
3) Delete all products that I no longer want
4) Delete all product categories that I no longer want
5) Delete all manufacturers that I no longer want
6) Run PHP delete_demo_data.php script (below)
I was planning on running the delete_demo_date.php PHP Script that was posted earlier in this post
Code: Select all
<?
include('config.php');
$db = mysqli_connect(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
$tables = array(
'address',
'category',
'category_description',
'category_to_store',
'coupon',
'customer',
'download',
'download_description',
'manufacturer',
'manufacturer_to_store',
'product',
'product_description',
'product_discount',
'product_featured',
'product_image',
'product_option',
'product_option_description',
'product_option_value',
'product_option_value_description',
'product_related',
'product_special',
'product_to_download',
'product_to_store',
'review',
'store',
'store_description',
'product_tags',
'order',
'order_download',
'order_history',
'order_option',
'order_product',
'order_status',
'order_total',
'product_to_category',
'coupon_description',
'coupon_product',
);
// for each table add a delete line to script
foreach ($tables as $table) {
$query = "TRUNCATE TABLE `oc_$table`;";
$result = mysqli_query($db, $query);
if (!$result) {
echo "<p>The data from $table was not deleted</p>";
echo "<p>$query</p>";
} else {
echo "<p>The data from $table was deleted</p>";
}
}
?>
Two questions:
1) Is this a comprehensive list of all OpenCart tables that should be TRUNCATED for OpenCart version 1.4.9.3? If not what tables should I add?
2) I understand that TRUNCATE TABLE opencart_table will reset the counter in the table (is this correct?)
Any help would be appreciated.