Merchant Solutions does offer a powerful feature whereby you can generate your site from a database. The process involves 2 steps:
This page explains first how to create files in the required format, and second, how to upload these files and generate your site from them.
Although this page describes the file format for database uploads in detail, you usually won't have to think about it unless an error occurs. Most spreadsheet or database programs can generate a correct CSV file for you automatically, if you choose "Save As", then "CSV File."
We recommend that you begin by generating a small CSV file with just a few records in it. Then look at the file to make sure it is correct. (For example, that the first line has the correct field names.) When it looks correct, try uploading it as a test. Once you have uploads working for a small file, you can go ahead and upload your real data.
File Format
The file format for database uploads has two parts:Here is an example of a small database file:
path,code,name,price
Cookies,F23,Chocolate Chip Cookies,4.95
Cookies,G12,Oatmeal Raisin Cookies,3.95
The first line says: The rest of this file will contain records of four fields each. The first field will be the path (the name of the section containing the item); the second will be the code (e.g. sku); the third will be the name; and the fourth will be the price.
When uploaded, this file will yield a store with one section, called Cookies, containing two items: Chocolate Chip Cookies at 4.95, and Oatmeal Raisin Cookies at 3.95.
It does not matter what order you put the fields in, so long as the field names in the first line match the records in the remaining lines.
This file would have exactly the same effect as the preceding one:
code,price,path,name
F23,4.95,Cookies,Chocolate Chip Cookies
G12,3.95,Cookies,Oatmeal Raisin Cookies
Notice also that records don't have to contain values for all the fields in an item. The examples so far do not include the caption field, for example. Here is a version of the same file that does include captions:
code,price,path,name,caption
F23,4.95,Cookies,Chocolate Chip Cookies,"These are the
best chocolate chip cookies you have ever tasted."
G12,3.95,Cookies,Oatmeal Raisin Cookies,
This example shows two things: first, that it is ok to use linebreaks within records, if they are enclosed in quotes. Also, this example shows that you can leave a field empty. The Oatmeal Raisin Cookies have no caption.
When you include a value for some field, it should appear exactly as you would type it into the form if you were building the site by hand. Blank lines, commas, and double quotes must be within quoted strings in order for the CSV converter to understand what you mean.
A "quoted string" is a series of characters beginning and ending with the double quote character ("). For example, when you edit an item by hand, you need to surround multiple-word options with double quotes. Since double quotes are already meaningful in the CSV format, begin and end the options field with a double quote, and use two adjacent double quotes wherever you need to include double quotes for multiple-word options.
Notice in the following example how the options for the Polo Shirt begin with a double quote. This allows you to separate different options with blank lines (Size and Color below) and to include multiple-word options (Sea Green). Sea Green has three quotes following: two to create the " for the form, and one to end the quoted string.
path,code,name,options,price
Shirts,F23,Polo Shirt,"Size S M L XL
Color Marigold Taupe ""Sea Green""",22.95
Pants,P12,Chinos,"Waist 32 34 36
Inseam 30 32 34",34.95
This yields a site with two sections, Shirts and Pants, each with one item, and each item with two options.
Make sure, when uploading a CSV file with an options field, that all of the options are enclosed in double quotes. If you use multiple-word option names or values, enclose these strings in sets of two double quotes ("") so that they come out as quotation marks in the form. For example:
You don't have to create sections to contain the items described in your file. They will be created automatically from the names you give in the path field.
If you want to create a site that is several sections deep, you can do it by separating section names by colons in the path field. This file
path,code,name,price
Nonfiction:Computers:Web,0-201-42379-1,HTML for Bozos,19.95
Nonfiction:Cooking:Vegetarian,0-201-41379-1,Turnips Galore,29.95
will create a section called Nonfiction, within that two sections called Computers and Cooking, and within those, sections called Web and Vegetarian respectively, with one book in each.
Before you upload files, you may want to check your data for these common mistakes.
Uploading Your Data
Once you have created your data file, here is how to upload it to the server:this point you will have to wait while the data is sent to the server. It could take up to 5 minutes if you have a giant file or a slow modem. A typical 28.8k modem transmits around 3k bytes per second, so if your data file is 300k, it will take nearly 2 minutes.
When the data has arrived at the server, you will see the database upload page again. (If you get "Document contains no data" instead, it probably means there was something wrong with your data file.) It will tell you how many records were in the file, and will show you the contents of the first one.
To check the 25th record, enter 25 in the box next to the Inspect button, then click on the button. If you check the first record, the last record, and one somewhere in the middle, that will usually be enough to insure that the data is ok.
Unless you have custom types or templates, leave the defaults for Item type, Item template, etc.
Now the final step, building your site. Here you have two choices:
you Rebuild or Add, and then on inspecting the site you find that there was something wrong with your data, you can still get your old site back. When you click on Rebuild or Add, the previous contents of your site are saved, and you can get them back by clicking on the Revert button.
Warning: The Revert button only works once. You can't go back and get your site as it was two Rebuilds or Adds ago. So check your site after every Add or Rebuild.
As a general rule, be very, very careful. At this point, you are using the computer equivalent of a chainsaw. As well as building your site with one button click, you can destroy your whole site with one button click. So if you are not sure you want to do something, don't do it. Call us first.
Frequently Asked Questions
Why does it say "document contains no data" when I upload my data?
Probably the field names were missing or not all on one line.
If you Add an item with the same name as an existing item, will the new one overwrite the old?
No, items are identified by their code fields. You can have two items with the same name. However, if you try to Add an item with the same code as an existing item, the new item will overwrite the existing one.
Is there a way to upload images en masse?
Yes, you can upload a zip file of images.
Can I get the contents of my site back from the server in the same format?
Not yet, but we plan to add that eventually.
Is there a limit on the size of file I can upload?
Our software will work for files up to about 14 MB. However, the browser itself may refuse to upload a file over a certain size. If you try uploading a giant file, and the browser seems to finish immediately, it was probably not sent.