Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Using an existing store as a template for new one


Marc_J

Recommended Posts

I've pretty much tweaked an osC store as much as I want to and am fairly happy with it, after around 39 contributions (mostly functional - the look is still fairly standard). Some of the contributions added tables to the database, as well as code changes. It's a live store, with around 250 products in the database, and orders, reviews etc.

 

Now, I want to do another one, on the same host, but with a different domain / title / categories / products etc.

 

What's the best way to take the installation of my tweaked story and "clone" it to a new store, without taking the categories, products, reviews and orders (and anything else that comes with a populated or live store)?

 

Would it be easiest to simply make an exact copy, then manually delete categories / products / reviews / customers / orders (either using phpMyAdmin or the osC admin)? If so, I'm not even sure how to go about doing that?

 

Or is it best to create a standard installation, run any sql queries from the contribs, then FTP and replace all the files with the modded ones? Would that work?

 

This is something I am going to be doing more than once, so the quickest and easiest way is best, as always!

Link to comment
Share on other sites

Well, I wouldn't say mine's the best approach. But if I'm to do it myself, I'll clone the entire site and database, and make changes to the new database copy through phpMyAdmin.

 

Simply empty all tables (please make sure it's the copy and not the original) except the following:

 

- configuration

- configuration_group

- countries

- currencies (I guess you'll want to keep this?)

- languages (I guess you'll want to keep this?)

- tax_class (I guess you'll want to keep this?)

- tax_rates (I guess you'll want to keep this?)

- zones

 

After that, go to Administration and change your store's configurations.

 

Hope that helps... :P

Link to comment
Share on other sites

Thanks!

 

I'm not 100% sure how to go about "cloning" the site. The files aren't a problem, but to clone the database do I create a new one (using cPanel's mySQL Databases tool), and add a user, then simply download a database backup from osCadmin (source site) and restore it the same way (destination osCadmin)?

Link to comment
Share on other sites

Like I've said, there are a number of ways to do that. If anyone has a better way, please feel free to chip in. Ok, this is how I will go about doing it:

 

1. Copy osCommerce Files to New Site

- copy all files and edit the new configuration files to change the URL, Paths and Database settings.

 

Step 1: using File Manager on cPanel, copy all files and directories in catalog folder (including Admin) to a new folder.

Step 2: edit catalog/includes/configure.php. Change HTTP_SERVER and HTTPS_SERVER to reflect your new URL. Change DIR_FS_CATALOG to reflect the physical folder path. Change DB_DATABASE to the new database you will be creating. If you are using a different username and password to access this database, change DB_SERVER_USERNAME and DB_SERVER_PASSWORD too.

Step 3: edit admin/includes/configure.php. Change HTTP_SERVER and HTTPS_SERVER to reflect your new URL. Change DIR_FS_DOCUMENT_ROOT, DIR_FS_ADMIN and DIR_FS_CATALOG to reflect the physical folder paths. Change DB_DATABASE to the new database you will be creating. If you are using a different username and password to access this database, change DB_SERVER_USERNAME and DB_SERVER_PASSWORD too.

 

2. Backup MySQL Database

- create 2 files: Database Structure and Database Data.

 

Step 1: go to phpMyAdmin.

Step 2: select your database from the dropdown box in the left column.

Step 3: click the Export tab at the top.

Step 4: under Export section, click on Select All to highlight all tables.

Step 5: under the SQL options section, check Structure but make sure Data is unchecked.

Step 6: finally, check the Save as file and click Go button.

Step 7: you will then be prompted for a location to save your file. If you wish, name this file structure.sql.

Step 8: under Export section, click on Unselect All. Then proceed to mark the following tables (to mark multiple tables, press Ctrl and click on each):

- configuration

- configuration_group

- countries

- currencies (I guess you'll want to keep this?)

- languages (I guess you'll want to keep this?)

- tax_class (I guess you'll want to keep this?)

- tax_rates (I guess you'll want to keep this?)

- zones

Step 9: after that, under the SQL options section, uncheck Structure and make sure Data is checked.

Step 10: finally, check the Save as file and click Go button.

Step 11: you will then be prompted for a location to save your file. If you wish, name this file data.sql.

 

3. Create New Database

- create a new Database and import structure and then data.

 

Step 1: create a new Database with your cPanel.

Step 2: go to phpMyAdmin.

Step 3: select your new database from the dropdown box in the left column.

 

If you are using phpMyAdmin 2.6.4-pl4 and below:

Step 4: click the SQL tab at the top.

Step 5: click on the Browse button and select your structure.sql file then click on Go.

Step 6: scroll to the bottom, click on the Browse button again and this time select your data.sql file then click on Go.

 

If you are using phpMyAdmin 2.7.0 and above:

Step 4: click the Import tab at the top.

Step 5: click on the Browse button and select your structure.sql file then click on Go.

Step 6: click on the Browse button again and this time select your data.sql file then click on Go.

 

4. Check New Site

- Now you can check out your new site. Rememeber to change your site settings in the Administration.

 

 

Hope that works for you as well. Good luck! :thumbsup:

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...