|
Hostahoy Shopping
Cart™ Importing / Exporting
Product Data |
[ main
menu ]
The Hostahoy Shopping
Cart™ allows for what we call shell mode configuration*.
This is generally for users with existing databases of many products. Shell
mode configuration requires shell access to a server and a touch of technical
know how. This document assumes the following:
- you know basic
database terms
- you know how to use
FTP to upload and download files
- you have an existing
database
- you have a full
version of the Hostahoy Shopping Cart
- you have shell access
to your server
- you are familiar with
the directory structure of the cart
Importing Data
If you
have an existing database of products you most likely already have all of the
required fields of a Hostahoy Shopping Cart™ database and some of the
optional fields, so why bother creating a new database from scratch? Importing
existing data lets you maintain your current database while saving you a lot of
time and effort!
In this
step by step example of importing and exporting data, we will use an example
product from our on-line demo store. Please note that your fields will
contain different information.
Step 1:
creating your
first item with the online wizard
Step 2:
preparing your
existing database
- The
import script reads in an ASCII delimited text file. This file can be
produced with any database on the market today. See your database
documentation on how to export data if you do not already know how.
- Export the data using a tab as the delimiter
(recommended) and no quotes around each field.
- Name
this newly created text file "cart_ascii.txt" and upload it (in ASCII mode) to
your cart directory**.
Step 3:
setting up and
running the import script gen_proddb.pl
- In
your cart directory is a script called gen_proddb.pl. This is a Perl
script that must be run from a shell that builds the new cart_db.txt file. We
need to customize the top portion to match the text file you just created and
uploaded. Here are the default entries:
- $CODE ='COL1';
$NAME ='COL2';
$CATEGORY ='COL3';
$PRICE ='COL4';
$TAXABLE ='COL5';
$INTRO ='COL6';
$IMAGE ='COL7';
$ICON ='COL8';
$OPTIONS_pldwn ='COL9';
$OPTIONS_check ='COL10';
$DISCOUNTS ='COL11';
$SHIPPING_SCHED ='COL12';
$MINIMUM ='COL13';
$RELATED ='COL14';
$RELATED_MSG ='COL15';
$FOOTNOTES ='COL16';
Assign the corresponding column in your
"cartt_ascii.txt" with the number with the Hostahoy Shopping Cart
variable. For example, if you have 5 columns and the 2nd column is the
CODE, then set the value to "COL" plus the column number "2"
$CODE='COL2';
If
you want the variable to be a fixed value for each, then enter the value
- ex: $TAXABLE='YES::'. If the variable is to be left blank, then leave blank -
ex: $OPTIONS_pldwn='';.
You
may end up running the script several times before you get the exact results
you are looking for.
- Make
sure the script is executable (755) and run the script at the command
line. This will create a new "cart_db.txt" file in your same directory
that the script is running within.
- Now
move this file to your admin directory and test it out!
Exporting Data
Converting your Hostahoy Shopping Cart™ database
to an offline database that you can use in other applications may be necessary
at times. To do this, we use the magic script called gen_ascii.pl in your cart directory. Unlike importing data,
there is really just one simple step.
Step 1:
exporting
- copy
your "cart_db.txt" file in your admin directory to your cartt
directory.
- run
the script gen_ascii.pl.
This will
create and plain text file in the same directory called "cart_ascii.txt". This
script uses a tab as the delimiter. The format is as follows:
- CODE NAME
CATEGORY PRICE
PINTRO IMAGE
ICONw ICONp
OPTIONSP OPTIONSC
DISCOUNTS SHIPPING RELATED_
RELATED TAXABLE MINIMUM
FOOTNOTES
* Offline configuration and shell mode configuration is
only available to the owner of the script.
** If you cannot run CGIs in any
directory but your cgi-bin, then move the script file and the file the script
needs to read in into the cgi-bin |