Technology TidBits

Answers to various technical questions on php programming, mysql, linux, and many more categories.
25% off Hosting at HostGator.com:
Use Code techbits25



How to upgrade from Sunshop 3.5 to Sunshop 4.x by making a parallel copy of the software.

Last updated: 02/08/2012

First, you need to realize that your templates are NOT going to upgrade.  If you made a lot of changes to them, you are in for a long haul.  These steps will create a second area for running sunshop, so you don't lose your current (working) store while you work on upgrading.

Step 1:  Make a new database - this should be doable through your hosting control panel

Step 2:  copy sunshop files

Here you basically want to make an exact copy of your files, so you can run a second shop for doing the upgrade.  If using FTP, make sure you use BINARY mode to transfer the files.

Step 3: copy database

Here's the SQL to copy directly from database A to database B - In this case my old database is called "lectures_db2" and my new one is the one I run these commands from.  You can use phpmyadmin to run these.  JUST MAKE SURE YOU ARE USING THE NEW DATABASE!

CREATE TABLE admin LIKE lectures_db2.admin;
INSERT admin SELECT * FROM lectures_db2.admin;
CREATE TABLE category LIKE lectures_db2.category;
INSERT category SELECT * FROM lectures_db2.category;
CREATE TABLE coupons LIKE lectures_db2.coupons;
INSERT coupons SELECT * FROM lectures_db2.coupons;
CREATE TABLE currency LIKE lectures_db2.currency;
INSERT currency SELECT * FROM lectures_db2.currency;
CREATE TABLE discounts LIKE lectures_db2.discounts;
INSERT discounts SELECT * FROM lectures_db2.discounts;
CREATE TABLE downloadcount LIKE lectures_db2.downloadcount;
INSERT downloadcount SELECT * FROM lectures_db2.downloadcount;
CREATE TABLE downloads LIKE lectures_db2.downloads;
INSERT downloads SELECT * FROM lectures_db2.downloads;
CREATE TABLE grouppricing LIKE lectures_db2.grouppricing;
INSERT grouppricing SELECT * FROM lectures_db2.grouppricing;
CREATE TABLE groups LIKE lectures_db2.groups;
INSERT groups SELECT * FROM lectures_db2.groups;
CREATE TABLE images LIKE lectures_db2.images;
INSERT images SELECT * FROM lectures_db2.images;
CREATE TABLE itemattributes LIKE lectures_db2.itemattributes;
INSERT itemattributes SELECT * FROM lectures_db2.itemattributes;
CREATE TABLE itemfields LIKE lectures_db2.itemfields;
INSERT itemfields SELECT * FROM lectures_db2.itemfields;
CREATE TABLE itemoptions LIKE lectures_db2.itemoptions;
INSERT itemoptions SELECT * FROM lectures_db2.itemoptions;
CREATE TABLE items LIKE lectures_db2.items;
INSERT items SELECT * FROM lectures_db2.items;
CREATE TABLE manufacturers LIKE lectures_db2.manufacturers;
INSERT manufacturers SELECT * FROM lectures_db2.manufacturers;
CREATE TABLE options LIKE lectures_db2.options;
INSERT options SELECT * FROM lectures_db2.options;
CREATE TABLE payment_modules LIKE lectures_db2.payment_modules;
INSERT payment_modules SELECT * FROM lectures_db2.payment_modules;
CREATE TABLE related LIKE lectures_db2.related;
INSERT related SELECT * FROM lectures_db2.related;
CREATE TABLE reviews LIKE lectures_db2.reviews;
INSERT reviews SELECT * FROM lectures_db2.reviews;
CREATE TABLE shipping_modules LIKE lectures_db2.shipping_modules;
INSERT shipping_modules SELECT * FROM lectures_db2.shipping_modules;
CREATE TABLE shiptable LIKE lectures_db2.shiptable;
INSERT shiptable SELECT * FROM lectures_db2.shiptable;
CREATE TABLE state_country LIKE lectures_db2.state_country;
INSERT state_country SELECT * FROM lectures_db2.state_country;
CREATE TABLE status LIKE lectures_db2.status;
INSERT status SELECT * FROM lectures_db2.status;
CREATE TABLE subcategory LIKE lectures_db2.subcategory;
INSERT subcategory SELECT * FROM lectures_db2.subcategory;
CREATE TABLE taxes LIKE lectures_db2.taxes;
INSERT taxes SELECT * FROM lectures_db2.taxes;
CREATE TABLE templates LIKE lectures_db2.templates;
INSERT templates SELECT * FROM lectures_db2.templates;
CREATE TABLE tracking LIKE lectures_db2.tracking;
INSERT tracking SELECT * FROM lectures_db2.tracking;
CREATE TABLE transaction LIKE lectures_db2.transaction;
INSERT transaction SELECT * FROM lectures_db2.transaction;
CREATE TABLE user LIKE lectures_db2.user;
INSERT user SELECT * FROM lectures_db2.user;
CREATE TABLE vendors LIKE lectures_db2.vendors;
INSERT vendors SELECT * FROM lectures_db2.vendors;
CREATE TABLE wishlist LIKE lectures_db2.wishlist;
INSERT wishlist SELECT * FROM lectures_db2.wishlist;

Step 4: update the database with new settings (options)

In the options table, you want to change the paths to use this copy of the shop you are creating.

Step 5: Edit your config.php

This should be under include/config.php - make sure you point it to the new database you created.

Step 6: Edit the upgrade script install/upgrades/upgrade_to_40.php

Look for any lines like this:

CHANGE `poverview` `short_desc`

and make sure the type is "TEXT" and not "VARCHAR(255)" or your short descriptions may get cut off when the items transfer over.

Step 6: Run the upgrade script

Step 7: Rename the install directory (make it a non-obvious name)

Step 8: Login to admin area and start editing

At this point, you should check your payment, shipping, and store settings.  The upgrade script seems to miss setting these, and probably some other settings.  Your original store should still be online and running, so you can take your time.  NOTE:  Using this method you will not have any new orders or product changes that happen during the interim until the new store goes live. 

Step 9:  When ready, move the files around to make the new store live.  You'll need to edit the database again to make sure the paths for the cart are correct.  This time it's the settings table, look for any lines with a path name in it, like "shop", "store", etc. and edit accordingly.

Step 10: After you move your old shop out of the way, you can edit the old database settings (options table) to keep that one usable for referencing any old data.

If this seems too daunting - give me a call - Jim Roberts, www.robertswebforge.com and I can give you an estimate to do the work.

 

 

blog comments powered by Disqus
Have your own Tech-bit to contribute? Submit it here

Other questions in this category:
My shopping cart disappears, or doesn't clear out properly when going from non-secure to the secure server - what's wrong?
How can I figure out which template does what in SunShop?
UPS module not working on php 5
In Sunshop 3.5, the 'Update Cart' button clears out my cart!
How do I secure the "tell a friend" feature of SunShop 3.5.1?
How do I add a new sort method for my products (SunShop 4.x)
How can I remove the "(Add $)" from my product options?
Why does my shop keep displaying the home page no matter what products I click on?
How do I edit the "related products" template in Sunshop 4?
Coupons by product / item don't seem to work on the 4.2 and 4.3 releases
My image verification is broken on the contact page - why?
On 1&1 hosting, I can't get Zend to work with Sunshop
Some of my pages get a "Error parsing template" when generating HTML pages in Sunshop
How can I add extra fields to my Sunshop Contact form that are not required?
How can I get the ioncube loaders working with GoDaddy?



Powered by KnowledgebasePublisher 1.1
Host Gator
Content provided by Roberts WebForge, Inc.