Post by duddy67 » Fri Oct 28, 2011 10:34 pm

Hi all,

I'd like to remove all sample data and start from scratch with a brand new OpenCart 1.5.x.
All infos I could get are for the 1.4.x versions

http://forum.opencart.com/viewtopic.php?t=13268

There's a script from Mike G which truncate the involved tables.
This script is for the 1.4 version but I tried it anyway. Obviously I
get error messages saying some tables don't exist.
So I removed these tables from the script:

Code: Select all

$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',  //Removed
    'product_image',
    'product_option',
    //'product_option_description',   //Removed
    'product_option_value',
    //'product_option_value_description',   //Removed
    'product_related',
    'product_special',
    'product_to_download',
    'product_to_store',
    'review',
    'store',
    //'store_description',  //Removed
    'product_tag', //remove the "s" at the end of "tag".
    'order',
    'order_download',
    'order_history',
    'order_option',
    'order_product',
    'order_status',
    'order_total',
    'product_to_category',
    //'coupon_description',   //Removed
    'coupon_product',
);
Now the script runs correctly and the sample data seems to be removed.
BUT I'm new with OpenCart and I'm not sure that the job has really been done.

So can someone tells me what are precisely the tables to be truncated ?


Thanks for advance

Newbie

Posts

Joined
Fri Oct 28, 2011 10:30 pm

Post by BMan » Tue Jan 03, 2012 11:32 am

I've tried this fix, (running the SQL script) on my current install 1.5.1.3.

My first question is there a better way to do this? I need some method I can experiment with. That is there needs to be an undo option.
Perhaps I have some kind of a perception issue, But I really don't see the point of having an online shop that comes loaded with a bunch of fake products that don't go anywhere and do me absolutely no good. I could see if I got a percentage if they sold, or they actually worked and the buttons took you somewhere or put the item in the cart...
On the other hand I do have some things I have in mind to sell, and I would like to be able to put some flashy nivo banner up with my product instead of once again a fake product.
On a related topic, what is with the Manufacturers bar, There are setting in the dashboard but they have almost no effect on what is displayed there... Hewlett Packard is the worst corporation in the history of capitalism. I definately do not want them displayed in my shop.

If I follow this SQL suggestion I get a shop with a galaxy samsung product in the Nivo Banner and no categories.
I am reluctant to do the work to list my products because without categories, I will likely give up on this installation and rip out and redo. But for now you can see what I've got at:
http://www.parsecsunlimited.com/shop

I would like to be able to list my own products be able to configure and add my product under some category such as software, and I want to be able to configure my own featured manufacturers and flush HP and the rest down the chutes.

BMan

Newbie

Posts

Joined
Tue Jan 03, 2012 8:59 am

Post by jty » Wed Jan 04, 2012 9:27 am

BMan wrote:I need some method I can experiment with. That is there needs to be an undo option.
The undo option is "backup"
Perhaps I have some kind of a perception issue, But I really don't see the point of having an online shop that comes loaded with a bunch of fake products that don't go anywhere and do me absolutely no good.
The point is as you state earlier - the sample data is for people to experiment with. If we were given clean databases with no data, we would all complain that we can't use it. Sample data is for learning and experimenting. Every piece of software has sample data

jty
Active Member

Posts

Joined
Sat Aug 30, 2008 8:19 am

Post by duddy67 » Fri Jan 20, 2012 4:18 pm

It seems we're a bit off board here, so I return to my initial question:

Can someone tells me what are precisely the tables to be truncated in order to get a clean and empty Opencart ?

Thanks

Newbie

Posts

Joined
Fri Oct 28, 2011 10:30 pm

Post by maya » Fri May 25, 2012 9:16 pm

duddy67 wrote:It seems we're a bit off board here, so I return to my initial question:
Can someone tells me what are precisely the tables to be truncated in order to get a clean and empty Opencart ?
Thanks
Yes, looking for this as well..
Thanks

Edit:

Ok, After the research and couple of tests I got this code. It is ONLY for fresh install of v1.5.3.1
Maybe there is not complete but this is the best I could get to empty the shop, so far.
If you can see some mistakes please post here additional info.

Code: Select all

DELETE FROM attribute;
DELETE FROM attribute_description;
DELETE FROM attribute_group;
DELETE FROM attribute_group_description;
DELETE FROM category;
DELETE FROM category_description;
DELETE FROM category_to_store;
DELETE FROM manufacturer;
DELETE FROM manufacturer_to_store;
DELETE FROM product;
DELETE FROM product_attribute;
DELETE FROM product_description;
DELETE FROM product_discount;
DELETE FROM product_image;
DELETE FROM product_option;
DELETE FROM product_option_value;
DELETE FROM product_related;
DELETE FROM product_reward;
DELETE FROM product_special;
DELETE FROM product_tag;
DELETE FROM product_to_category;
DELETE FROM product_to_store;
DELETE FROM url_alias;

User avatar
Newbie

Posts

Joined
Sat Feb 18, 2012 1:46 am
Location - London

Post by karttika » Wed Aug 29, 2012 3:26 am

Thanks, it works for me in v 1.5.4.1

Newbie

Posts

Joined
Wed Aug 29, 2012 2:25 am

Post by i2Paq » Tue Sep 04, 2012 1:54 am

better use: truncate

Code: Select all

TRUNCATE attribute;
TRUNCATE attribute_description;
TRUNCATE attribute_group;
TRUNCATE attribute_group_description;
TRUNCATE category;
TRUNCATE category_description;
TRUNCATE category_to_store;
TRUNCATE manufacturer;
TRUNCATE manufacturer_to_store;
TRUNCATE product;
TRUNCATE product_attribute;
TRUNCATE product_description;
TRUNCATE product_discount;
TRUNCATE product_image;
TRUNCATE product_option;
TRUNCATE product_option_value;
TRUNCATE product_related;
TRUNCATE product_reward;
TRUNCATE product_special;
TRUNCATE product_tag;
TRUNCATE product_to_category;
TRUNCATE product_to_store;
TRUNCATE url_alias;

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by nicolasconnault » Thu Sep 06, 2012 4:36 pm

jty wrote:The point is as you state earlier - the sample data is for people to experiment with. If we were given clean databases with no data, we would all complain that we can't use it. Sample data is for learning and experimenting. Every piece of software has sample data
Another point is that it's very useful for developers :-)


Posts

Joined
Thu Sep 06, 2012 4:33 pm

Post by jiapei100 » Wed Sep 26, 2012 9:11 pm

Unfortunately, I installed OpenCart 1.5.4.1 ....
However, after removing all demo products, I'm not able to bring up my own product up to the front page....
I see it clearly that I added a product, which I also assigned a category.
Unfortunately, on the home page, click the particular category that this product belongs to, I just fail to see the product in such a category.

This seems to be an extremely serious error caused by "removing/not using the demo data"....
Is there a full solution to "avoiding using the demo data" of OpenCart ???

Cheers
Pei


Code: Select all

DELETE FROM attribute;
DELETE FROM attribute_description;
DELETE FROM attribute_group;
DELETE FROM attribute_group_description;
DELETE FROM category;
DELETE FROM category_description;
DELETE FROM category_to_store;
DELETE FROM manufacturer;
DELETE FROM manufacturer_to_store;
DELETE FROM product;
DELETE FROM product_attribute;
DELETE FROM product_description;
DELETE FROM product_discount;
DELETE FROM product_image;
DELETE FROM product_option;
DELETE FROM product_option_value;
DELETE FROM product_related;
DELETE FROM product_reward;
DELETE FROM product_special;
DELETE FROM product_tag;
DELETE FROM product_to_category;
DELETE FROM product_to_store;
DELETE FROM url_alias;

Welcome to FoscamBC
http://www.foscambc.ca


New member

Posts

Joined
Wed Sep 26, 2012 8:40 am
Location - Surrey, BC, Canada

Post by VZV » Tue Oct 30, 2012 11:55 pm

Hi,

you can try delete all insert's from install sql file wish is opencart.sql, maybe it will help

VZV
Newbie

Posts

Joined
Tue Oct 30, 2012 11:52 pm

Post by Nyrk0 » Wed Oct 31, 2012 11:15 am

that happen when the-demo-data-installed-as-solution-guide-for-begginners is removed. lol? ;)

New member

Posts

Joined
Tue Sep 18, 2012 4:46 am

Post by TimesArrow » Sun Dec 02, 2012 7:21 am

day One with Opencart - ive been trying to figure out how NOT to load this sample data that automatically loads on install. that's how i ended up here. i started to delete the categories, products in the back end but then thought what else might be left that i don't know about. there should be a better way that running a delete script because i'm not that familiar with doing something that could crash the database and/or tables. sure seems no sample data should be an option!

Newbie

Posts

Joined
Sun Dec 02, 2012 7:13 am

Post by rmullaney77 » Thu Mar 14, 2013 10:10 pm

It would be nice to see an "exclude sample data" option during install ;)

--------------------------------------------------
My BlogMy ExtensionsOpenCart Templates


User avatar
Active Member

Posts

Joined
Fri Nov 19, 2010 2:08 am
Location - Tampa, Florida

Post by Sakunne » Fri Jun 07, 2013 10:36 pm

To remove sample data before installation you should modify opencart.sql file in install directory

Deleting data after:
-- Dumping data for table `oc_some table'

Until next:
-- Table structure for table `oc_next_table`

And images from 'image' folder

The basic concept considering database integrity is that if you remove a table with primary key: some_id you should delete sample data from ALL tables using that key.

For example:
If you delete sample data from table 'oc_product':
-- Dumping data for table `oc_product`
You should also delete sample data after:
-- Dumping data for table `oc_product_attribute`
-- Dumping data for table `oc_product_description`
-- Dumping data for table `oc_product_discount`
-- Dumping data for table `oc_product_image`
-- Dumping data for table `oc_product_option`
-- Dumping data for table `oc_product_option_value`
-- Dumping data for table `oc_product_related`
-- Dumping data for table `oc_product_reward`
-- Dumping data for table `oc_product_special`
-- Dumping data for table `oc_product_to_category`
-- Dumping data for table `oc_product_to_store`

This is for OpenCart 1.5.5.1

User avatar
Newbie

Posts

Joined
Thu Jun 06, 2013 4:40 am
Location - Tallinn, Estonia

Post by opencart-templates » Sun Mar 30, 2014 3:04 am

No idea why there isn't an options to not install the demo data.... anyway I find myself doing this all the time so wrote a quick script that should make it easier for everybody.
  1. Truncates database tables
  2. Deletes demo images + resize cache
  3. Clear cache database
Simple upload this file into your store root then visit: mystoreurl.com/clean_up.php

Advanced Professional Email Template
Customers Pre-Sale. Inc abandoned cart email
Order Follow-Up Email. Inc request review
Email Validation with ZeroBounce


User avatar
Active Member

Posts

Joined
Mon May 16, 2011 7:24 pm
Location - UK

Post by CoastWeb » Fri Apr 04, 2014 8:18 am

Hi opencart-templates

Thanks for the script, one little problem though.

This script didn't actually work for me (OpenCart 1.5.6.1) because $all_tables contained an array of tablenames with table prefix, but $tables contained an array of tablenames without prefixes, therefore the if(in_array condition always failed for me (it would work if there was no table prefix defined when setting up open cart).

So I simply changed the if(in_array condition to:

Code: Select all

if(in_array(DB_PREFIX .$table, $all_tables)){
to make it work. You might want to update your script so others don't have the same problem.

Also there are some tables the script doesnt truncate which look like they could be truncated, although this being my first time looking at OpenCart, i'm not sure if they should be emptied or not. They are:
category_path, customer_group, customer_group_description, and geo_zone.

P.S. I agree that there should be an option on the installer wheter to setup sample data or not.

Newbie

Posts

Joined
Fri Apr 04, 2014 7:50 am

Post by opencart-templates » Sat Apr 05, 2014 11:18 pm

CoastWeb wrote:Hi opencart-templates

Thanks for the script, one little problem though...
Thanks for that, just updated with prefix and added category_path. Probably best to leave the customer group it can be essential for some areas of the store to have at least one.

Advanced Professional Email Template
Customers Pre-Sale. Inc abandoned cart email
Order Follow-Up Email. Inc request review
Email Validation with ZeroBounce


User avatar
Active Member

Posts

Joined
Mon May 16, 2011 7:24 pm
Location - UK

Post by Nibbleicous » Fri Oct 31, 2014 9:45 pm

opencart-templates wrote:
CoastWeb wrote:Hi opencart-templates

Thanks for the script, one little problem though...
Thanks for that, just updated with prefix and added category_path. Probably best to leave the customer group it can be essential for some areas of the store to have at least one.
I have just used the clean up file you provided. It work's great, very clever setup. Thank you.

Newbie

Posts

Joined
Fri Oct 31, 2014 7:08 pm

Post by sunsys » Thu May 14, 2015 10:40 am

I don't really understand what is the fuss about, what is the issue if some sample data is preloaded.

OC installation comes with some sample data to get the user started. If you don't want the sample data why are you touching the sql database is what I cannot comprehend. Just go to category page and products page and delete all the data there and you will have a clean system, same can be done for all other fields(options, attributes etc), just select all and hit delete, this way you will also keep the database structure intact, what more do you need ??

Regards,
Sun Systems
Industrial Electronics and Instrumentation


User avatar
Active Member

Posts

Joined
Tue Jan 27, 2015 5:19 am
Who is online

Users browsing this forum: No registered users and 6 guests