Web technologies change; with time new systems become favored over others. This recently happened when a client inquired about moving her ecommerce site from Zen Cart to WordPress. Having developed the original Zen Cart website I was familiar with the complexities of maintaining a Zen Cart instance. By comparison WordPress is relatively simple, and is also better aligns with my current strategies towards managing websites.
The Zen Cart site had about 1,800 products, and so recreating the products individually was not practical. Using WP All Import Pro with the WooCommerce Add-On facilitated moving the products without manually recreating each one.
If you would like personalized consulting to migrate your website to a new content management system, contact me. If you want to take the DIY approach then see my following tutorial on moving from Zen Cart to WooCommerce.
Exporting the Zen Cart products
- From phpMyAdmin select the database name where Zen Cart is installed and click the Export tab.
- Use the custom export method, and select the products table in your first export.
- Leave the format-specific options at their default, which should include comma separated columns.
- Choose the CSV format, and make sure that Put columns names in the first row is checked.
- Click Go to save this file locally.
- Repeat steps 2-5, but this time select the products_description table instead of the products table.
You might also wish to export some other tables depending on whether your products have attributes. In this case I also wanted to export meta information, and so I downloaded the tables meta_tags_categories_description and meta_tags_products_description.
Combine and restructuring the CSV exports
This turned out to be by far the most time consuming part of the procedure.
- Open the resulting CSV files in LibreOffice Calc or another spreadsheet application.
- Ensure that you import the files with comma separation, which will match your export format from phpMyAdmin.
- Freeze the header row in each file which includes the column names (i.e. select row 2 and then click Window>Freeze).
- Select all of the rows (excluding column headers) in each CSV file and sort the data by the products_id column. i.e. select the rows and click Data>Sort, select Column A (or whichever column holds the product id) and sort ascending.
- Next copy and paste all of the columns from the products_description file into new columns in the products file. To do this: Select the products description file and click column A + shift click the last column letter. Copy those columns, and then in the other file select the first empty column (in my case column AJ).
- Close the now unneeded products_description file.
- At this point you can delete all of the unneeded columns, including the redundant products_id and products_name columns from the second
Categories might be a problem for you depending on how your products were configured. In the case of my client’s website, I had to manually move category information from the categories table, and match it up to the rows in the products database. For me it was a manual process. In total there were three category IDs per product because of the hierarchal product catalog (Parent Category > Child Category > Child Category).
Move product images to WordPress
Since the product table from phpMyAdmin includes a relative path to each image, we can reuse them without needing to manually add pictures later.
- Move all of the product image files from the Zen Cart images folder to your WordPress uploads directory. To ensure that the files are indexed properly inside WordPress, put them into a folder following the WordPress date structure (i.e. wp-content/uploads/2017/03/). Grab images from any sub folders in your images folder which are in use (I needed to pull some category images out of the images/category folder). You won’t need to retain the folder structure, just get the files.
- In your CSV file clean up the image paths to remove any folders. For example if your category images are stored in a category subfolder than do a search & replace to remove the category/ from each filename.
Install the WP All Import plugin
You will need to purchase WP All Import Pro along with the WooCommerce add on. The plugins are expensive, but save a lot of time.
Import your categories
The WP All Import website has extensive documentation about using their plugin. Be sure to upload your product categories using the Taxonomies > Product Categories import.
For images, be sure that when you use the WP All Import token/shortcode you prefix it with the filepath for the images.
Import your products
Once again refer to the WP All Import site for detailed instructions. All I will add is that you should be sure to retain the products_id column from Zen Cart so that WP All Import has a unique identifier for each of your products.
Need to make adjustments?
You can rerun the import if you want to add additional information so long as you have a unique identifier for each product (retained from Zen Cart unless you had unique inventory numbers). You can even use WP All Import to make bulk updates to your catalog from a CSV file without needing to use WooCommerce.
If things went horribly wrong
Simply go to WP All Import and delete the import. The plugin is capable of completely reversing the import, right down to deleting everything it uploaded.