03 Mar 2010 @ 3:00 PM 
 

Zen Cart store duplication

 

For those Zen Cart fans out there that have previously set up a Zen Cart store and want to save a load of time for when you need to configure a new one, you can try following some of the steps outlined in this post.  I know it has saved me personally hours and hours of configuring a new store.

Duplicating the store and database in a few easy steps: -There was an instance where we needed to quickly create another instance of the exact same store with a separate database, and separate folder structure for the store.

  • Duplicate the database–The easiest way to do this is to open the PHPMyAdmin interface and create a blank database you intend to use for the new store.  For simplicity’s sake of this example we’re going to keep the same naming convention of the new folder we need  to  create,  and the database name.  So, with that in mind we’ll call the new database “new_store”.There are two primary ways I’ve found to duplicate the original database.  Obviously, you can export the existing database to a flat file using the PHPMyAdmin tools, and then import the file into the new database, which is probably least amount of work.  The new way I discovered in Windows is to copy the contents of the old database folder to the newly created database folder.  There will be one file in the new database folder (new_store) which you can move somewhere else or just overwrite.
  • Create a new folder- Within the wwwroot folder (sometimes /var/www if hosting on Linux or c:\xampp\htdocs if running on Windows, create a new folder along side of the existing folder called “new_store” (or what ever you choose to name the new folder).  In our case the original store was in the default folder called “store”, which is in the root of the web folder.
  • Copy the contents – Now from the original store folder, copy the contents and place them into the new folder.  On Windows platforms this is a simple copy and paste if you have full control of the server, or in the case of a hosted solution or Linux server, you can download the content via FTP and then upload to the new folder.
  • Set the permissions– On Windows, there should be no changes needed, however you will need to make 2 configuration files writeable to alter the database path and store path in a later step.  The locations of the 2 files are: \new_store\includes\configure.php\new_store\admin\includes\configure.php

    On Linux servers, you can connect via FTP and set the permissions for both files to be 777.  Also make the \new_store\images folder 777 as well.  In a windows environment, you will right click on the configure.php files and uncheck the “read-only” attribute.
  • Modify the configuration files– Open each of the configure.php files in a suitable editor.  I prefer to use something like Dreamweaver or any other editor capable of recognizing php code.  If using Windows, notepad will work, however it will not be formatted nicely and make it harder to find some of the tags needed for editing.  Once the files are open for editing you will want to modify the following lines of code to show the new path to the store and the database:In the “\new_store\includes\configure.php” file:

define(’HTTP_SERVER’, ‘http://<your_domain_here>’);
define(’HTTPS_SERVER’, ‘http://<your_domain_here>’);

define(’DIR_WS_CATALOG’, ‘/new_store/’);
define(’DIR_WS_HTTPS_CATALOG’, ‘/new_store/’);

define(’DIR_FS_CATALOG’, ‘/var/www/new_store/’);

define(’DB_SERVER_USERNAME’, ‘<Your DB_User>’);
define(’DB_SERVER_PASSWORD’, ‘<Your_Password>’);
define(’DB_DATABASE’, ‘new_store’);

In the “\new_store\admin\includes\configure.php” file:

define(’HTTP_SERVER’, ‘http://<your_domain_here>’);
define(’HTTPS_SERVER’, ‘http://<your_domain_here>’);
define(’HTTP_CATALOG_SERVER’, ‘http://<your_domain_here>’);
define(’HTTPS_CATALOG_SERVER’, ”http://<your_domain_here>’);

define(’DIR_WS_ADMIN’, ‘/new_store/admin/’);
define(’DIR_WS_CATALOG’, ‘/new_store/’);
define(’DIR_WS_HTTPS_ADMIN’, ‘/new_store/admin/’);
define(’DIR_WS_HTTPS_CATALOG’, ‘/new_store/’);

define(’DIR_FS_ADMIN’, ‘/var/www/new_store/admin/’);
define(’DIR_FS_CATALOG’, ‘/var/www/new_store/’);

define(’DB_SERVER_USERNAME’, ‘<Your DB_User>’);
define(’DB_SERVER_PASSWORD’, ‘<Your_Password>’);
define(’DB_DATABASE’, ‘new_store’);

Once the changes are saved to these 2 files, you will want to either copy them up to the server if on Windows, or FTP them if on Linux to their respective directories.

  • Set Security – Now that the changes have been made and saved, the files need to be made un-writable (read-only).  On Linux, using an FTP client set the permissions on these 2 files to 444.  In Windows, right click on the files and then place a check in the “read-only” box and apply.
  • Ready to go! – After having done all these changes, you should now be able to run your new store by going to http://yourdomain.com/new_store.  If everything worked properly, you should see the store as it was in the old URL path, however it is a distinct new database that is separate and disjoined from the original.  You should now make a small test to confirm you are indeed working with the new database.  Login to the Admin interface at http://yourdomain.com/new_store/admin .  From there, make a small tweak to a test user account and verify that this change did not affect the original store.  This will indeed confirm if you are running a separate and unique store that is a duplicate or the original. One semi-critical thing to keep in mind after the new store has been set up, is to double check any side boxes , banners or footers for links that lead back to the original site.  You can make these changes in the Admin area (typically under  Tools > Banner Manager).
Tags Categories: Zen-Cart Posted By: Jose Negron
Last Edit: 03 Mar 2010 @ 03 00 PM

E-mailPermalink
 

Responses to this post » (One Total)

 
  1. Mick said...
    6:22 am - June 9th, 2010

    Great tips Jose; an excellent reminder when you’re creating a new Zencart store and you’ve spent a long time installing great Mods on an existing site that greatly enhances the functionality of Zencart as it is out of the box.

 

Leave A Comment ...

 

 XHTML:
You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
\/ More Options ...
Change Theme...
  • Users » 2
  • Posts/Pages » 16
  • Comments » 41
Change Theme...
  • VoidVoid
  • LifeLife « Default
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LiteLight
  • No Child Pages.