I won’t have enough time to write a full tutorial for a while, so I’ll cover as much of the process as I can now, to get you started if you’re facing a similar issue.
I was commissioned to optimize a site for search engines. The site was running on GoDaddy’s Quick Shopping Cart software. GoDaddy does quite a bit to your content to make sure you can’t edit it easily. They also make it extremely difficult to export your site’s ecommerce content to another server.
My client had just shy of 600 products on her site, and I didn’t want to have to mess with that much data working remotely. My goals were as follows:
- Pull remote content to my local development environment (laptop)
- Scan through each HTML file to find product name, attributes, and image name
- Assign images from the image folder to their respective products
- Re-name images for SEO purposes
- Import all product data into WooCommerce
This is not an easy process, and there is cost involved in importing (quickly) into WooCommerce. If the site in question has less than 30 products, I’d just as soon do this entire move manually; but since the site I was moving had almost 600 products, that would have taken me about 2 weeks, and that wasn’t a viable option.
Copy the Website
The first thing I did was download HTTrack. It take some prior UNIX/Linux knowledge to install, and I installed it on Mac OSX 10.8. I don’t know how to install it on Windows, and I’d probably do just fine installing it on Linux. If you don’t know your way around the Terminal, this could be a bit tough. Leave your questions in the comments, and I’ll do my best to answer them.
Find the Products
The next step involves sifting through all of the static HTML files that GoDaddy creates (one for each product) and gathering the product name, the SKU, and the image filename. I was only dealing with one image per product, so you’ll have to do a bit more sleuthing to get other associated image names.
If you take a look at the source code on a Quick Shopping Card page, you can see that the SKU, Product Name, and Product Image are all wrapped in ‘telling’ elements or classes. With the proper search tools, it is totally possible to automate the process of creating a CSV (comma separated value) with every element you’re looking for.
To do this, I used the PHP Simple HTML DOM Parser. The following code shows how I searched through the HTML files in the site one at a time, searching for the relevant elements.
Not All at Once
I did not search for all of the items in one fell swoop. This process is highly processor-intensive, and when I tried to run a complete loop, my computer froze. I had to split it up into searches of 100 files at a time. Each time I generated the CSV output I wanted, I would copy/paste it into a new document that would end up being my master CSV.
If I were to spend more time making a commercial application, I would read the docs for each of these libraries, and create an application that could go through an entire Quick Shopping Cart library without a single hiccup. (Maybe in the future.)
Importing Into WooCommerce
The export feature on GoDaddy’s Quick Shopping Cart does indeed come in handy here. You’ll need to export a full spreadsheet of all your files to work off of. Once you have that spreadsheet, it will become the basis for your import into WooCommerce.
To perform the import, you’ll need the Product CSV Import Suite from WooCommerce. It runs $99, and it will come in indispensable during this process. Install it on your WordPress site, and get ready to import.
You’ll need to convert the spreadsheet exported from Quick Shopping Cart into a CSV. Make sure a ‘comma’ is the delimiter. Assign the product name to the ‘post_title’ value, and you’ll be creating WooCommerce products in no time. Be sure the SKU gets connected to the SKU value in WooCommerce as well.
Rename Those Damn Images
You’re about to import another CSV into WooCommerce, but do you really want your images to be named 14783728759287028375.jpg? No, you want them to be named ‘My Awesome Product – My Shop.jpg’. So now we need to rename them. How better than to use a sweet PHP script again? Fair Warning: I don’t claim that my scripts are efficient or even good. They simply get the job done, even if sloppily.
Here’s the script I used to rename each of the images based on the title of the product. This is a good start for proper SEO on the site, even if more tweaking will be necessary in the future. Here’s the script I used to rename the images:
***MISSING CODE, sorry!***
More CSV’s and Importing
I created another CSV (In Textmate) with this photo info. Basically, you just need the SKU and the image filename, as long as you’ve uploaded your renamed images to the /year/month/ folder that corresponds with the month you’re performing this ridiculous feat. If they’re all uploaded and you’ve uploaded your CSV into the Product CSV Import Suite, you should have a working WooCommerce Installation with photos on all your images.
Even after I did all of this, there were still a couple of missing images, which I had to match with the similarly named Products by searching the media gallery for images with that Product Name.
This is obviously very messy, and it would be much easier for me to host a site running the HTTrack software live, where I could simply have someone enter their site’s domain name, and my ‘Solution Site’ would take care of the rest, creating a CSV ready to import into WooCommerce.
My goal is to build this site soon and probably host it on its own Linode. However, I’ll need a bit more demand and a bit more time to work out the kinks. Until then, good luck wading through this tutorial.