Post by Qphoria » Mon Apr 12, 2010 10:56 am

For those who do a fresh install but don't want to have to clean up all the DEMO data..

Right after install, execute this sql in your phpmyadmin sql window. Change "oc_" to your own prefix.

WARNING! DO NOT USE ON A LIVE STORE UNLESS YOU WANT TO LOSE EVERYTHING!

Code: Select all

DELETE FROM oc_address;
DELETE FROM oc_category;
DELETE FROM oc_category_description;
DELETE FROM oc_category_to_store;
DELETE FROM oc_coupon;
DELETE FROM oc_customer;
DELETE FROM oc_download;
DELETE FROM oc_download_description;
DELETE FROM oc_manufacturer;
DELETE FROM oc_manufacturer_to_store;
DELETE FROM oc_product;
DELETE FROM oc_product_description;
DELETE FROM oc_product_discount;
DELETE FROM oc_product_featured;
DELETE FROM oc_product_image;
DELETE FROM oc_product_option;
DELETE FROM oc_product_option_description;
DELETE FROM oc_product_option_value;
DELETE FROM oc_product_option_value_description;
DELETE FROM oc_product_related;
DELETE FROM oc_product_special;
DELETE FROM oc_product_to_download;
DELETE FROM oc_product_to_store;
DELETE FROM oc_review;
DELETE FROM oc_store;
DELETE FROM oc_store_description;
DELETE FROM oc_product_tags;
DELETE FROM oc_order;
Last edited by Qphoria on Sat Jun 25, 2011 12:07 am, edited 2 times in total.
Reason: Made sticky

OpenCart 2.0.x Mod Update Info

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Johnathan » Mon Apr 12, 2010 11:21 pm

Thanks, this will save time on future installations. One question: could you do this through using the "Restore" function with a file that has those queries?

Image
Image Image Image Image Image Image


User avatar
Global Moderator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by Qphoria » Tue Apr 13, 2010 12:13 am

Theoretically it should work.

OpenCart 2.0.x Mod Update Info

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by cmebd » Tue Apr 13, 2010 4:19 am

Brilliant - thanks muchly :-)

A stupid question is the one you -don't- ask.........(Anon)

)C1.5.0.1 (IN devel)
OC V1.4.9.5
OC V1.4.9.2
OC V1.4.7
OC V1.3.4


User avatar
Active Member

Posts

Joined
Fri Nov 13, 2009 11:17 am
Location - Tasmania, Australia

Post by OSWorX » Tue Apr 13, 2010 4:42 am

Wondering why this is not an option with the installer as I am doing it with the German Edition:

1. installation with sample data (as it is now)
2. installation WITHOUT sample data

No need for any further action.

Image


User avatar
Expert Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by Qphoria » Tue Apr 13, 2010 6:06 am

Because rome wasn't built in a day

OpenCart 2.0.x Mod Update Info

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Chrissy Poo » Wed Apr 14, 2010 8:35 pm

Great Job!

Thank You :)

10% Discount on all Shared and Reseller Hosting Packages at Vidahost.com

Discount Code: DISCOUNT10


Active Member

Posts

Joined
Mon Jun 29, 2009 8:48 am
Location - UK

Post by sykic » Thu Apr 22, 2010 6:28 pm

I think to get a completely emty store you need to add the following tables

oc_order_download;
oc_order_history;
oc_order_option;
oc_order_product;
oc_order_status;
oc_order_total;
oc_product_to_category;
oc_coupon_description;

perhaps an OC expert could confirm

Code: Select all

DELETE FROM oc_address;
DELETE FROM oc_category;
DELETE FROM oc_category_description;
DELETE FROM oc_category_to_store;
DELETE FROM oc_coupon;
DELETE FROM oc_customer;
DELETE FROM oc_download;
DELETE FROM oc_download_description;
DELETE FROM oc_manufacturer;
DELETE FROM oc_manufacturer_to_store;
DELETE FROM oc_product;
DELETE FROM oc_product_description;
DELETE FROM oc_product_discount;
DELETE FROM oc_product_featured;
DELETE FROM oc_product_image;
DELETE FROM oc_product_option;
DELETE FROM oc_product_option_description;
DELETE FROM oc_product_option_value;
DELETE FROM oc_product_option_value_description;
DELETE FROM oc_product_related;
DELETE FROM oc_product_special;
DELETE FROM oc_product_to_download;
DELETE FROM oc_product_to_store;
DELETE FROM oc_review;
DELETE FROM oc_store;
DELETE FROM oc_store_description;
DELETE FROM oc_product_tags;
DELETE FROM oc_order;
DELETE FROM oc_order_download;
DELETE FROM oc_order_history;
DELETE FROM oc_order_option;
DELETE FROM oc_order_product;
DELETE FROM oc_order_status;
DELETE FROM oc_order_total;
DELETE FROM oc_product_to_category;
DELETE FROM oc_coupon_description;
DELETE FROM oc_coupon_product;

Getting to like opencart, will I ever love it ?


User avatar
Newbie

Posts

Joined
Fri Apr 16, 2010 10:46 pm

Post by Qphoria » Thu Apr 22, 2010 8:01 pm

Yea those few product ones and coupons should be added. There should be no orders by default and i left that code out incase someone might screw up their real site.

OpenCart 2.0.x Mod Update Info

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by rich06 » Fri Jul 02, 2010 11:01 pm

Shouldn't oc_url_alias also be added to the list?

Rich

Newbie

Posts

Joined
Fri Jul 02, 2010 10:50 pm

Post by JAY6390 » Fri Jul 02, 2010 11:07 pm

Yeah it should. Think it was mentioned that in future releases the test data would be an option in the install process

ImageImageImage

SEO MEGA KIT PLUS - Get your site ranking higher in the search engines
Better Product SEO URL's - Perfectly structured product links
SEO URL's Route Editor PRO - Make ANY url on your site have clean keywords - even third party extensions (remove index.php)


Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Qphoria » Sat Jul 03, 2010 3:13 am

It was requested... not necessarily going to be there ;)

OpenCart 2.0.x Mod Update Info

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by JAY6390 » Sat Jul 03, 2010 3:22 am

Ah OK lol O0

ImageImageImage

SEO MEGA KIT PLUS - Get your site ranking higher in the search engines
Better Product SEO URL's - Perfectly structured product links
SEO URL's Route Editor PRO - Make ANY url on your site have clean keywords - even third party extensions (remove index.php)


Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Nayar » Tue Aug 17, 2010 11:19 pm

OSWorX wrote:Wondering why this is not an option with the installer as I am doing it with the German Edition:

1. installation with sample data (as it is now)
2. installation WITHOUT sample data

No need for any further action.
Agreed. Just as Joomla does.

However, it is not a priority for now as it is easy to delete the datas manually;)

User avatar
Newbie

Posts

Joined
Mon Aug 16, 2010 10:30 am


Post by tommyla » Fri Sep 17, 2010 4:27 am

would make sense to have a vanilla version without all the bloat, people are gonna remove it anyway, and everyone can test the store with the demo here or at some other place

meybe make a addon, like "demoproducts-install.zip" at google code instead of having every single release default to demo install ;)

this will make everyone happy so we dont need to upload over 100 useless files

Active Member

Posts

Joined
Wed Jul 22, 2009 9:49 pm
Location - Norway

Post by JAY6390 » Fri Sep 17, 2010 4:40 am

This is another good idea on how to streamline the code for opencart. I know Q has been working his butt off to reduce large repetitive code to smaller chunks of code, hopefully this will make it into a future release of opencart

ImageImageImage

SEO MEGA KIT PLUS - Get your site ranking higher in the search engines
Better Product SEO URL's - Perfectly structured product links
SEO URL's Route Editor PRO - Make ANY url on your site have clean keywords - even third party extensions (remove index.php)


Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by SXGuy » Wed Sep 29, 2010 10:55 pm

I also think you should include the code to reset the increment count back to 0 as well, i dont really like the idea of new products starting from the last demo product ID etc.

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by mgirouard » Fri Oct 01, 2010 10:32 am

Howdy friends. I found this thread useful with a recent install so thanks :)

I've hacked up a quick PHP script which solves this problem, but in a little more OpenCart-ish way. Hopefully someone else finds it useful.

The Gist is available here:
http://gist.github.com/605619

and I've written up a quick example here:
http://www.lovemikeg.com/2010/09/30/cle ... mple-data/

Best to you all,
Mike G.

Newbie

Posts

Joined
Fri Oct 01, 2010 10:29 am

Post by eyeweb » Tue Nov 16, 2010 11:39 pm

Just thought I would update this.

ALthough your script does the job, (well with some slight modifications, such as closing the php off ;) ), it could be far simpler.

Simply create a file called whatever you want (I go with delete demo-data.php) and copy the below into it).

Then place the file in your opencart install root (the same place where your config.php file is).

Visit the page in a browser i.e http://www.yourdomain.com/delete-demo-data.php

Once completed, simply delete the file from the root, job done :)

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>";
    }
}

?>

Newbie

Posts

Joined
Wed Jul 21, 2010 5:05 pm

Post by SapporoGuy » Tue Dec 07, 2010 4:00 am

Does this also set the table counts back to zero?

930sc ... because it is fun!


User avatar
Active Member

Posts

Joined
Mon Nov 01, 2010 7:29 pm
Who is online

Users browsing this forum: No registered users and 12 guests