How To: Perform a clean installation w/ Data Backup and Restore

SmithCart


If you're doing a clean installation on a live site you may need to need retain your customer, order and product data. The following article explains how to backup and restore your store data when doing a clean installation.

Contents

 

Data Backup

In order to restore store data after an install you must first make a backup of your data so that it will not be deleted when uninstalling the software. To backup SmithCart store data take the following steps:

Step 1 - Make a Backup Database

 

Create a new database titled “StoreBackup”

 

Step 2 – Select Current Store Database

 

Connect to the database you are exporting "from"

 

Step 3 – Start Import/Export Wizard

 
  • Right click on the database you are exporting from to start the Import/Export wizard
  • Select the "Tasks" item, then either click the "Export Data" menu item
 

Step 4 – Select Store Data Tables

 

Follow the wizard and export any Smith tables containing info you would like to retain

For Example:

  1. Smith_Products
  2. Smith_Product_Variants (if your store doesn’t have variants then you don’t need to back this up)
  3. Smith_ProductVariantGroup (if it has data)
  4. Smith_Category
  5. Smith_CategoryProduct
  6. Smith_Manufacturer
  7. Smith_Orders
  8. Smith_OrderDetails
  9. Smith_Customer
  10. Smith_PayHist
 

Step 5 – Store Data Backup Complete

 

This completes the steps to make a backup of your store data

[up to contents]


SmithCart Uninstall

Step 1 - Uninstall Smith module components

 

From the dnn->host menu uninstall the following

  1. All Smith modules (Make sure you check the delete files box when you uninstall)
  2. Smith Image Gallery Widget
 

Step 2 - Confirm Smith Stored Procs and Tables are deleted

 

Confirm that all stored procedures and tables with a prefix of “smith” in your database are deleted

You can run the following SQL scripts to remove all smith tables and stored procedures, so you don't have to do it manually.


Remove all tables:
DECLARE @SQL VARCHAR(1000)
DECLARE @tempName VARCHAR(1000)
DECLARE @count VARCHAR(1000)
select @count = COUNT(*) from dbo.sysobjects where type = 'U' and name like 'smith%'
while @count > 0
Begin
Select @tempName = name from dbo.sysobjects where type = 'U' and name like 'smith%'
exec('drop table ' + @tempName)
set @count = @count - 1
END
 
Remove All Stored Procs:
DECLARE @SQL VARCHAR(1000)
DECLARE @tempName VARCHAR(1000)
DECLARE @count VARCHAR(1000)
select @count = COUNT(*) from dbo.sysobjects where type = 'p' and name like 'smith%'
while @count > 0
Begin
Select @tempName = name from dbo.sysobjects where type = 'p' and name like 'smith%'
exec('drop procedure ' + @tempName)
set @count = @count - 1
END
 
 

Step 3 - Confirm Smith Files Are Deleted

 

Confirm that all Smith files in the /desktopmodules folder are removed

 

Step 4 - Reset IIS

 

Reset IIS to release the cache

 

[up to contents]


Reinstall and Data Restore

To restore existing store data, SmithCart needs to be reinstalled before the existing store data can be migrated into the new store.

Take the following steps to reinstall and restore your data:

Step 1 - Install SmithCart

 

Install the latest SmithCart package onto your site

 

Step 2 - Connect To New Store Database

 

Connect to the database you are importing "to"

 

Step 3 – Start Import/Export Wizard

 
  • Right click on the database you are importing to from to start the Import/Export wizard
  • Select the "Tasks" option, then click the "Import Data" menu item
 

Step 4 – Select Source Store Data Tables

 

Follow the wizard and import the all Smith tables that include data

For Example:

  1. Smith_Products
  2. Smith_Product_Variants (if your store doesn’t have variants then you don’t need to restore this)
  3. Smith_ProductVariantGroup (if it has data)
  4. Smith_Category
  5. Smith_CategoryProduct
  6. Smith_Manufacturer
  7. Smith_Orders
  8. Smith_OrderDetails
  9. Smith_Customer
  10. Smith_PayHist
 

Step 5 - Edit Mappings

 

On the wizard screen check the box next to the tables you want to import and click “Edit Mappings

Check the box titled “Enable Identity Insert” as depicted in the follow screen:

 

Step 6 - Finish Import Wizard

 

Click ok and finish the wizard

 

Step 7 - Verify Data Import

 

Verify that the data was imported to your live tables

 

Step 8 - Add New BuyNow Module

 

On your DNN portal navigate to the page where you want to add your BuyNow module and add the BuyNow module to the page

 

Step 9 - Add New Test Data

 

Go to the Store Admin Menu and click “Manage Categories” and add a new category called “testcat”

 

Step 10 - Locate New TabModuleID

 

Now that the new store and data is in place you need to get the new TabModuleID of the store to update the old data with. Each Product, and Category are assigned a TabModuleID which tells the module which page to display the data on

  1. Expand the tables and right click on the “Smith_Category” table and click “Select All Rows”
  2. Scroll down to the “testcat” record you just added and write down the value of the “tabmoduleid” field. Note its different from the data you imported
  3. Open query analyzer and run the following update query:
    UPDATE Smith_Products SET TabModuleID=(NewNumber) WHERE TabModuleID=(OldNumber)
    UPDATE Smith_Categories SET TabModuleID=(NewNumber) WHERE TabModuleID=(OldNumber)
    UPDATE Smith_Product_Variants SET TabModuleID=(NewNumber) WHERE TabModuleID=(OldNumber)
    UPDATE Smith_Manufacturers SET TabModuleID=(NewNumber) WHERE TabModuleID=(OldNumber)
    UPDATE Smith_Orders SET TabModuleID=(NewNumber) WHERE TabModuleID=(OldNumber)
 

Step 11 - Confirm Successful Import

 

Navigate to your buynow module and your categories and products should now be displayed

 

Step 12 – Store Data Backup Complete

 

This completes the steps reinstall and restore your SmithCart data

 

[up to contents]