* BACKUP YOUR DATABASE * BACKUP YOUR DATABASE * BACKUP YOUR DATABASE *
BACKUP YOUR DATABASE *
|
If
you do not know how to backup and restore your SQL database, you should not use this contribution. The potential for
great catastrophe is VERY GREAT !! Easy Populate
comes with no warranty. If it loses your data, it's not any of the
contributors fault. Always test new modifications and contributions on a
development or backup store.
|
How to Use
1.
Open
up your internet browser and go to your osCommerce
Store Admin Panel
Go to osCommerce Admin -> Catalog -> Easy Populate
2.
Click
one of the links at the bottom of the box marked "Create then
Download Files" and save the file to your local machine.
3.
Edit
the file in Excel or OpenOffice. Windows users just right click and "Open with" ->
Excel.
4.
After
you are done editing, save the file:
·
Windows-Excel
users: should Save as... CSV (MS-DOS) in most
cases,
or as a "Text (tab delimited)" file from Excel if a tab delimited
file is desired.
or MAC-Excel users, Save as... Windows-CSV. (see Instructions for MAC Users below)
·
OpenOffice users: as a "Text" file, check the "edit
MORE HERE"
·
Those
with special character needs (such as cyrillic),
use Open Office
See Special Instructions for Non-Roman Character Sets
(below)
5.
If
you have more that 300
items in your store, read the SPECIAL
INSTRUCTIONS FOR LARGE STORES
6.
Now
go back to Admin -> Catalog ->
Easy Populate and click the upper Browse button, find
your file that you want to upload, then click Upload
and Insert Into Database.
7.
The
file will be uploaded to your store. You should see a display that lists the
items you are importing. If the last row appears blank, and complains
that it can't import this record, all is fine,
it's not unusual to get this error at the end of the file.
8.
If
you'd like to use FTP and upload the file, put it in the EP_TEMP_DIRECTORY
directory, and then put the filename in the box under "Upload from
Temp dir" and click Insert Into Database.
Remember the file must be readable by the username that the web server is
running as. You might have to chmod 777 the
uploaded file to let the script read it.
What does EP do
with my data? (How it works)
When you upload a file, this is what EP does:
·
Breaks
the file into lines based on the explicit field named "EOREOR".
This word "EOREOR" must appear in the last field in each
row of your data, or EP won't work.
·
Reads
the first row to get the names of the fields you are importing. This is why
you must have the header row in the file.
·
Checks
to see if there is a valid product_model in the
row, if it's not there, throw an error and go on to the next row.
·
Checks
to see if the category & Manufacturer given exist in the database. If
they do, it updates teh category image. If they do
not exist, it creates the category/subcategories as needed, and then puts
the product into that category/subcategory.
If you are using a multilanguage shop, the
category name with the language ID that is first in your language Sort Order
is used to compare and find the existing cateogry.
You can change the language Sort Order in the Admin -> Localization ->
Languages. The language with the first Sort Order will always be used to
compare existing Categories.
The remaining category names are updated. If another row is found with the
same Model number, but a different category, then that product is added to
the second cateogry and all product information is
updated again. This is similar to the osCommerce
"copy Product" using the Link Product method.
·
Checks
to see that the product_model is not too long.
Stock OSC comes with just 12 characters available for the product_model. If you need more than 12, change your
database and edit easypopulate.php and change the configuration variable
EP_MODEL_NUMBER_SIZE. If it is not the right size, the import stops right
then.
·
If
the product_model does not exist in the database,
the product is created with the information given (price, weight, qty). If
it does exist, then the database is updated.
Can I add a
product to more then one category? Yes!
Duplicate the product row, then change the
category name. Each row in the EP upload file
will place the product in a different category the same as the osCommerce Admin does a "link" to multiple
categories.
Easy
Populate File Format
This
describes the file layout for the "Complete" download
1.
fields are delimited with a single "separator"
character.
2.
fields do not need to be enclosed in quotes, unless it contains
quotes or the separator character you are using.
3.
Each
import file should have a row at the top (header row) that defines each
column. The column headings are as follows.
4.
The
first product's data follows the header row avoiding any blank lines.
Products are setup one line per product.
The names of all the fields in order are:
·
v_products_model
·
v_products_image
·
v_products_name_N
// where N is the language ID
·
v_products_description_N //
where N is the language ID
·
v_products_url_N
// where N is the language ID
·
v_products_price
·
v_products_specials_price // Special
Price
·
v_products_weight
·
v_date_added
// YYYY-MM-DD
·
v_date_avail
//
YYYY-MM-DD
·
v_products_quantity
·
v_manufacturers_name
·
v_categories_image_1
·
v_categories_name_1_1 //
root category, language ID 1 (English)
·
v_categories_name_1_2 //
root category, language ID 2 (Deutsch)
·
v_categories_name_1_3 //
root category, language ID 3 (Español)
·
v_categories_image_2
·
v_categories_name_2_1 //
second level cateogry (first sub-cat), language ID
1 (English)
·
v_categories_name_2_2 //
second level cateogry (first sub-cat), language ID
2 (Deutsch)
·
v_categories_name_2_3 //
second level cateogry (first sub-cat), language ID
3 (Español)
·
v_categories_image_3
·
v_categories_name_3_1 //
third level category (second sub-cat), language ID 1 (English)
·
v_categories_name_3_2 //
third level category (second sub-cat), language ID 2 (Deutsch)
·
v_categories_name_3_3 //
third level category (second sub-cat), language ID 3 (Español)
·
v_tax_class_id
·
v_status
// Active, Inactive, or Delete
·
EOREOR // ALL ROWS MUST END
WITH A "EOREOR" in the last cell
·
The following
items are optional and will only be used if you have other contributions
installed, and the items enabled in this contribution's settings.
·
# If you have turned on support for Additional Images,
the following are available:
·
v_products_image_description // Primary Image
description
·
v_products_image_N // Where N is a
sequential number for each additional image.
·
v_products_image_description_N // Where N is a
sequential number for each description.
# If you have turned on support for MVS the following is available:
·
v_vendor // Nane of the Vendor. You must create the vendor manually
before import.
# If you have turned on support for the X-Sell contribution the
following is available:
·
v_cross_sell // Contains a
comma separated list of related model numbers.
# If you have turned on PDF File Upload and Display the following
are available:
·
v_products_pdfupload
·
v_products_fileupload
# If you have turned on support for UltraPics
the following are available:
·
v_products_image_med
·
v_products_image_lrg
·
v_products_image_sm_1
·
v_products_image_xl_1
·
v_products_image_sm_2
·
v_products_image_xl_2
·
v_products_image_sm_3
·
v_products_image_xl_3
·
v_products_image_sm_4
·
v_products_image_xl_4
·
v_products_image_sm_5
·
v_products_image_xl_5
·
v_products_image_sm_6
·
v_products_image_xl_6
# If you have turned on support for More Pics
6 the following 6 are available:
·
v_products_subimage1
·
v_products_subimage2
·
v_products_subimage3
·
v_products_subimage4
·
v_products_subimage5
·
v_products_subimage6
# If you have turned on support for Header Tags Controller these 3
are available:
·
v_products_head_title_tag_N
// where N is the language ID
·
v_products_head_desc_tag_N
// where N is the language ID
·
v_products_head_keywords_N
// where N is the language ID
# If you have turned on support for Separate Pricing Per Customer,
use these 2:
# Note: these must appear in pairs!! You cannot have a price without
an ID.
·
v_customer_price_N
// where N is the ordinal number of groups/prices
·
v_customer_group_id_N //
match this with the v_customer_price_N
"N" from above.
·
'v_products_model' The
model number for the product. You must add this to each line and all v_products_model must be unique.
·
'v_products_image' The
name of the image file for the product. May contain subdirectories (i.w. mysubdir/mypic.gif). If
left blank, it will default as set in the configuration section of
easypopulate.php
·
'v_products_name_1',
'v_products_description_1' and 'v_products_url_1' For each language you have active in your store, you'll
get a name, description and url for that product.
·
'v_products_price' Price you want listed.
·
'v_products_specials_price' Is
this product on special? Use this column for osCommerce
Special.
·
'v_products_weight' Weight. Assumes you're using
the default weight
·
'v_date_avail' When the
product will become available. Defaults to today if left blank.
·
'v_date_added' When the
product will be reported as being added to the database. Defaults to today
if left blank.
·
'v_products_quantity' Number of the products you
have on hand. If left blank, it defaults to 1000
·
'v_manufacturers_name' and 'v_categories_image'
The name of the manufacturer. If not already in the
database, it will be created
·
'v_categories_image_1'
·
'v_categories_name_1_1'
// root category, language ID 1 (English)
·
'v_categories_name_1_2'
// root category, language ID 2 (Deutsch)
·
'v_categories_name_1_3'
// root category, language ID 3 (Español)
·
'v_categories_image_2'
·
'v_categories_name_2_1'
// second level cateogry (first sub-cat), language
ID 1 (English)
·
'v_categories_name_2_2'
// second level cateogry (first sub-cat), language
ID 2 (Deutsch)
·
'v_categories_name_2_3'
// second level cateogry (first sub-cat), language
ID 3 (Español)
·
'v_categories_image_3'
·
'v_categories_name_3_1'
// third level category (second sub-cat), language ID 1 (English)
·
'v_categories_name_3_2'
// third level category (second sub-cat), language ID 2 (Deutsch)
·
'v_categories_name_3_3'
// third level category (second sub-cat), language ID 3 (Español)
The category hierarchy that this product should be listed under. Note that
v_categories_name_1_1 is the Highest level
category, in English.
The first number of the categories name field is the category level. The
number 1 is the highest or top category.
The second number of the categories name field is the language. The number
is the language id. In a default osC ship they
will be 1 = English,
2 = Deutsch, 3 = Español.
An example: If you are selling cars and you want to list a Pontiac Aztec,
you'd have something like this:
Cars -> General Motors -> Pontiac
for categories, and the Aztec would be listed in the Pontiac
subcategory.
So your data would look like this:
v_categories_name_1_1 = Cars, English
v_categories_name_2_1 = General Motors, English
v_cateogries_name_3_1 = Pontiac, English
See, highest level category to lowest level category.
·
'v_tax_class_id' The tax status you want to assign
to this product
·
'v_status' The status you
want to set for this item. Defaults to Active. To make the product inactive,
put the word Inactive in the field. Note: If
you set a
product with zero quantity active, and the EP_INACTIVATE_ZERO_QUANTITIES
flag in the configuration constants section is set to true, it will be
inactive in the database. If you want to use different words for
Active/Inactive, you can change the configuration variables EP_TEXT_ACTIVE,
EP_TEXT_INACTIVE, and EP_DELETE_IT in the configuration
constants section of /catalog/admin/easypopulate.php
file.
Valid entries in this column are: Active, Inactive or Delete
·
'EOREOR'
This is a REQUIRED FIELD!
It gives an explicit end to the row of data. This must appear on every row
of your data.
Special
Instructions for Large Stores
If
your store has over 300 products, you will likely run into PHP timeout
issues. The maximum time that a script can run is set in the php.ini file.
The default is 30 seconds, and it seems that most people can upload about
300 items within that time.
If your store is over 300 items, you must split the file before it can be
uploaded. You can do this by hand, or you can use the file-splitting feature
of EP. If you split by hand remember that EP expects the first row in every
file to be the headers, and will throw this line out. So if you don't have
the header row, the code with not work
correctly.
To split a file with EP:
·
Go
to Admin -> Catalog -> Easy
Populate
·
Click
the lower browse button and get the file you want to split.
·
Click
the button named "Upload and Split file".
The file will be split into sections, each with 300 products, the last
one being shorter as needed. These new files will be saved in the /catalog/temp directory, and will be named like this: EP_Split1.txt,
EP_Split2.txt, etc.
Import each file using the "Import EP file from Temp Dir"
section of the EP main page.
If these files are still to large, edit easypopulate.php
and change the configuration constant EP_SPLIT_MAX_RECORDS to a
smaller number. This controls how many records are put into a single file
when you split it. You may also increase that number if your PHP
installation will handle the additional records without timing-out.
For those attempting to upload large files, remember, PHP has a limit built
in so if your upload simply refreshes the page and nothing happens, no
output is provided, then you may have a file that is too large for your PHP
settings.
|