Recent blog posts
| |
User login
| | |
Navigation
| | |
Latest Activity
| |
We read
| |
osCMax BugTracker
| |
Who's online
| | There are currently 2 users and 45 guests online. |
Syndicate
|  |
| | -------------------------------------------------
I. ABSTRACT
-------------------------------------------------
Easy Populate (EP) was designed to provide a vehicle for moving products from
one shop to another or as a means to store product sets for developers.
What does it do now?
EP as progressed to a tool for exporting product details for easy editing
in text or with Excel. After, we can import the product detail back into
the osCommerce database with changes.
EP lets you quickly populate and update thousands of products
in many categories for an OSC store with data from an; Excel spreadsheet,
OpenOffice spreasheet, Filemaker database, Access database. Any delimited
text file (you can now set a config var for the separator character).
We can also export sets of products based on a category, manufacturer, or
the product's status (visible/not visible) for editing, moving to another
site or storing.
EP supports multiple categories, multiple languages, creates Categories
and Manufacturers on the fly, unlimited levels of categories/subcategories
are supported, products without pictures can be defaulted to a standard
"no picture available" image and file uploading via browser or grab a
file from the temp directory.
*****************************************************************************
** Exports from previous versions of EP will not work correctly since the **
** category header names have changed in this version !! **
*****************************************************************************
What does EP *NOT* do well?
So far, EP does not handle attributes well. When viewing product export, it
may be difficult to understand how it works. As such, I'do not recommend
that anyone use EP for managing attributes.
EP does not handle "download" attributes.
The default behavior of EP is to Add & Update. If you download a product,
change its category, then upload, EP will add the product to the new category.
EP will not remove it from the previous category. EP does not move products
from one category to another either.
The code is improved but still needs work. The code will read the entire
product database into server memory before producing the export. New features
improve the export file building to avoid loading the entire export file
in memory also.
-------------------------------------------------
II. IMPORTANT NOTES
-------------------------------------------------
****************************
****************************
*** BACKUP YOUR DATABASE ***
****************************
****************************
If you do not know how to backup and restore your database, you
should not use this contribution. PERIOD !! The potential for
great catastrophe is VERY GREAT !!
EasyPopulate comes with no warranty. If it hoses your data, it's not my
problem. You always test everything on your dev store first, right? (hint, hint!).
-------------------------------------------------
III. CREDITS
-------------------------------------------------
Much recoding for v2.76d+ contributed by surfalot [mtholforty(at)surfalot(dot)com]
(thank you to all those offering praise!!)
Thanks to these sponsors - their financial support made the 2.4 release possible!
Support for Froogle downloads sponsored by Ted Joffs
This module was derived by Tim Wasson from the Excel Import 1.51 by dynamok.
Elari has contributed much of the multi-language product names and description support - Thanks!
Original Author: wasson65@nc.rr.com ;-)
-------------------------------------------------
IV. REQUIREMENTS
-------------------------------------------------
EasyPopulate v2.76d+ requires an osC 2.2 MS2. It will not work with 2.1.
EP expects a directory to exist at /catalog/temp, and it needs to have
permissions set so that EP can read and write files there. To set the
perms, you can ftp in and do a "chmod 777 temp". This may be changed
in the settings at the file’s top.
If you have made database changes to the products, products_description,
or other product or category related tables, you may have some
issues running the stock EasyPopulate.
EasyPopulate requires the use of the product_model field (model number).
It won't work without the model number. The model numbers you assign
must be unique, i.e. you can't give all your products a product_model of "test".
EasyPopulate will import tab, comma, semi-colon, or any other
user-defined-separator delimited files. The default separator is a tab.
If you have tabs in your product descriptions, it's going to cause problems.
If you save from Excel as a "csv" file, it won't work. If you want to
change the separator, there is a variable in the configuration section
of easypopulate.php. Whatever you change it to, test it! Remember that
any of those separator characters anywhere in your data will cause EP to
think that's another column of data! (see next note)
As of Version 2.76d, you may now enable the Excel safe output and input.
This will now safely export any data (English test only), edit in excel,
and reimport the data safely preserving tabs, commas, and carriage returns
in your product’s description.
Each EP file must have the header row in place. If you upload a file
without the headers, EP will throw out your first row of data.
EP should work fine on shared servers, servers with safe_mode set,
and servers with magic_quotes turned on or off.
If you set the quantity of an item to zero, EP will automatically
make the item Inactive in the database. To change the behaviour,
see the Configuration Variables section.
EP does NO formatting or conversion of date formats. It gives
you exactly what came out of mysql, and it takes exactly the data
you give EP and shoves it into mysql. If you use a format that is
not the mysql default, you'll push bad data into your date fields
in your database. Use this format and you'll avoid problems: YYYY-MM-DD.
Also, be aware that backslashes can confuse EP and the database
because the backslash character is the escape character for strings
in mysql. This issue may have been solved with Excel safe output option.
-------------------------------------------------
V. INSTALLATION
-------------------------------------------------
The files in the EasyPopulate contribution are:
/easypopulate.php -- the code
/easypopulate_functions.php -- some functions
/catalog/admin/includes/classes/table_block.php -- upload to fix a bug in osCommerce 2.2 MS2.
/license.txt -- the GPL license text that EasyPopulate (EP) is released under.
/history.txt -- History of changes to this project.
/sample_output_file.txt -- Sample of the export.
/docs/1readmeFIRST.txt
/docs/EasyPopulate_Manual.txt
1. Copy file easypopulate.php and easypopulate_functions.php into
/catalog/admin/ or whatever folder you have placed the osCommerce admin.
2. Copy the file /catalog/admin/includes/classes/table_block.php into
/catalog/admin/includes/classes/ folder, overwriting the current file
if you have not made any changes to this file before.
This file fixes a bug documented here: http://www.oscommerce.com/community/bugs,2003
3. For adding link to the Admin, edit file admin/includes/boxes/catalog.php.
## After:
'<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS_ATTRIBUTES . '</a><br>' .
## Add this:
'<a href="' . tep_href_link('easypopulate.php', '', 'NONSSL') . '" class="menuBoxContentLink">Easy Populate</a><br>' .
4. Make sure that you have a temp directory under your catalog directory.
Set the permissions to allow writes to that directory (while you're in
the catalog directory, execute "chmod 777 temp" from your SSH or FTP
software). If you do not know how to do this, ask your host to do it for you.
Many of you will have to create this folder under your shop's main
catalog folder. Your main catalog folder contains the file checkout_success.php.
Find that file and create a folder called "temp". Set the permissions
to 777. If you do not know how to do this, ask your host to do it for you.
If you need to change the temp folder to some other location, the following
setting will correct this throughout the script. You'll find it near the
the top of the /admin/easypopulate.php file:
define ('EP_TEMP_DIRECTORY', DIR_FS_CATALOG . 'temp/');
5. You should check with your host to find out what the maximum upload size
for your PHP environment is. Then you need to find out the length of time
the script is allowed to run. Then you know the key details that will allow
you to configure your EP, or your host environment, or limit your data, to
perform the upload. Both of those items can be changed by uploading a php.ini
to your admin directory if your host allows that. Ask your host.
See this post about maximum file size uploads for PHP:
http://forums.oscommerce.com/index.php?showtopic=162244&st=5900&p=1101458&#entry1101458
6. PLEASE DO THIS!!!!!: Go to easypopulate.php and read the section marked
"Configuration Variables". It will allow you to adjust EP's operation
for your store. I meant what I said, Please, Pretty please, do read the
entire configuration stuff. Really. You'll be glad you did since if you
don't and come to the support topic asking question the docs answer, you
may simply get asked to read the docs anyway. You'll find all kinds of
neat configurable stuff there.
7. The following is not required to run this contribution. This may help many
with large databases. It was submitted by UGLi 6 May 2006. It is a SQL
command you run in your SQL tool provided by your host, such as phpMyAdmin.
Copy and paste the following line in your SQL command tool:
ALTER TABLE `products` ADD INDEX `idx_products_model` ( `products_model` );
-------------------------------------------------
VI. SETTINGS (found at top of easypopulate.php)
-------------------------------------------------
This is a brief description of the settings. See the easypopulate.php file
settings for more information and configuration options.
// This should point to the temporary directory you have setup in step 4 above.
define ('EP_TEMP_DIRECTORY', DIR_FS_CATALOG . 'temp/');
//**** File Splitting Configuration ****
// we attempt to set the timeout limit longer for this script to avoid having to split the files
// NOTE: If your server is running in safe mode, this setting cannot override the timeout set in php.ini
// uncomment this if you are not on a safe mode server and you are getting timeouts
// set_time_limit(330);
// if you are splitting files, this will set the maximum number of records to put in each file.
// if you set your php.ini to a long time, you can make this number bigger
define ('EP_SPLIT_MAX_RECORDS', 300); // default, seems to work for most people. Reduce if you hit timeouts
//define ('EP_SPLIT_MAX_RECORDS', 4); // for testing
// set them to your own default "We don't have any picture" gif
define ('EP_DEFAULT_IMAGE_MANUFACTURER', '');
define ('EP_DEFAULT_IMAGE_PRODUCT', '');
define ('EP_DEFAULT_IMAGE_CATEGORY', '');
// Set the v_status field to "Inactive" if you want the status=0 in the system
define ('EP_TEXT_ACTIVE', 'Active');
define ('EP_TEXT_INACTIVE', 'Inactive');
// Set the v_status field to "Delete" if you want to remove the item from the system
define ('EP_DELETE_IT', 'Delete');
// If zero_qty_inactive is true, then items with zero qty will automatically be inactive in the store.
define ('EP_INACTIVATE_ZERO_QUANTITIES', false); // default is false
//**** Size of products_model in products table ****
// set this to the size of your model number field in the db. We check to make
// sure all models are no longer than this value. this prevents the database from
// getting fubared. Just making this number bigger won't help your database! They must match!
// If you increase the Model Number size, you must increase the size of the field
// in the database. Use a SQL tool like phpMyAdmin (see your host) and change the
// "products_model" field of the "products" table in your osCommerce Database.
define ('EP_MODEL_NUMBER_SIZE', 12); // default is 12
//**** Price includes tax? ****
// Set the EP_PRICE_WITH_TAX to
// false if you want the price that is exported to be the same value as stored in the database (no tax added).
// true if you want the tax to be added to the export price and subtracted from the import price.
define ('EP_PRICE_WITH_TAX', false); // default is false
//**** Price calculation precision ****
// US Currency uses 2 digits behind the decimal place, so for the US this should be 2
// NOTE: when entering into the database all prices will be converted to 4 decimal places.
define ('EP_PRECISION', 2); // default is 2
// **** Quote -> Escape character conversion ****
// If you have extensive html in your descriptions and it's getting mangled on upload, turn this off
// set to true = replace quotes with escape characters
// set to false = no quote replacement
define ('EP_REPLACE_QUOTES', false); // default is false
// **** Field Separator ****
// change this if you can't use the default of tabs
// Tab is the default, comma and semicolon are commonly supported by various progs
// Remember, if your descriptions contain this character, you will confuse EP!
// if EP_EXCEL_SAFE_OUTPUT if false (below) you must make EP_PRESERVE_TABS_CR_LF false also.
$ep_separator = "\t"; // tab is default
//$ep_separator = ','; // comma
//$ep_separator = ';'; // semi-colon
//$ep_separator = '~'; // tilde
//$ep_separator = '*'; // splat
// *** Excel safe output ***
// When I (surfalot) start using this contribution, I was surprised to see that I couldn’t
// export the test database from osCommerce and reimport it without errors. This is because
// Easy Populate wasn’t handling tabs in the product descriptsion correctly. Tried using
// commas, same problem. So I saw the need to this addition. When set to true, you should
// be safe exporting to a CSV, opening in Excel saving and reimporting without loosing any
// commas, tabs, and carriage returns. Data should be safe from getting split up incorrectly
// just because you wanted a comma, quote or tab in your description.
//
// Later it was reported that other countries used symbols other then the comma as the default
// Separator when importing CSV files into Excel. I have added code to handle that. Currently
// it is only detecting the German language. Contact me for help in other languages/countries.
// I am Surfalot on the osCommerce forums (mtholforty(at)surfalot(dot)com)
//
// this setting will supersede the previous $ep_separator setting and create a file
// that excel will import without spanning cells from embedded commas or tabs in your products.
// if EP_EXCEL_SAFE_OUTPUT if false (below) you must make EP_PRESERVE_TABS_CR_LF false also.
define ('EP_EXCEL_SAFE_OUTPUT', false); // default is: true
// if EP_EXCEL_SAFE_OUTPUT if true (above) there is an alternative line parsing routine
// provided by Maynard that will use a manual php approach. There is a bug in some
// PHP versions that may require you to use this routine. This should also provide proper
// parsing when quotes are used within a string. I suspect this should also resolve an issue
// recently reported in which characters with a german "Umlaute" like ÄäÖöÜü at the Beginning
// of some text, they will disappear when importing some csv-file.
define ('EP_EXCEL_SAFE_OUTPUT_ALT_PARCE', false); // default is: false
// *** Preserve Tabs, Carriage returns and Line feeds ***
// this setting will preserve the special chars that can cause problems in
// a text based output. When used with EP_EXCEL_SAFE_OUTPUT, it will safely
// preserve these elements in the export and import.
define ('EP_PRESERVE_TABS_CR_LF', false); // default is: false
// **** Max Category Levels ****
// change this if you need more or fewer categories.
// set this to the maximum depth of your categories.
define ('EP_MAX_CATEGORIES', 7); // default is 7
// **** Product Attributes ****
// change this to false, if do not want to download product attributes
define ('EP_PRODUCTS_WITH_ATTRIBUTES', true); // default is true
// change this to true, if you use QTYpro and want to set attributes stock with EP.
define ('EP_PRODUCTS_ATTRIBUTES_STOCK', false); // default is false
// change this if you want to download only selected product options (attributes).
// If you have a lot of product options, and your output file exceeds 256 columns,
// which is the max. limit MS Excel is able to handle, then load-up this array with
// attributes to skip when generating the export.
$attribute_options_select = '';
// $attribute_options_select = array('Size', 'Model'); // uncomment and fill with product options name you wish to download // comment this line, if you wish to download all product options
// The following setup will allow you to define any additional
// field into the "products" and "products_description" tables
// in your shop. If you have installed a custom contribution
// that adds fields to these tables you may simply and easily add
// them to the EasyPopulate system.
//
// ********************
// ** products table **
// Lets say you have added a field to your "products" table called
// "products_upc". The header name in your import file will be
// called "v_products_upc". Then below you will change the line
// that looks like this (without the comment double-slash at the beginning):
// $custom_fields[TABLE_PRODUCTS] = array(); // this line is used if you have no custom fields to import/export
//
// TO:
// $custom_fields[TABLE_PRODUCTS] = array( 'products_upc' => 'UPC' );
//
// If you have multiple fields this is what it would look like:
// $custom_fields[TABLE_PRODUCTS] = array( 'products_upc' => 'UPC', 'products_restock_quantity' => 'Restock' );
//
// ********************************
// ** products_description table **
// Lets say you have added a field to your "products_description" table called
// "products_short_description". The header name in your import file will be
// called "v_products_short_description_1" for English, "v_products_short_description_2" for German,
// "v_products_short_description_3" for Spanish. Other languages will vary. Be sure to use the
// langugage ID of the custom language you installed if it is other then the original
// 3 installed languages of osCommerce. If you are unsure what language ID you need to
// use, do a complete export and examine the file headers EasyPopulate produces.
//
// Then below you will change the line that looks like this (without the comment double-slash at the beginning):
// $custom_fields[TABLE_PRODUCTS_DESCRIPTION] = array(); // this line is used if you have no custom fields to import/export
//
// TO:
// $custom_fields[TABLE_PRODUCTS_DESCRIPTION] = array( 'products_short_description' => 'short' );
//
// If you have multiple fields this is what it would look like:
// $custom_fields[TABLE_PRODUCTS_DESCRIPTION] = array( 'products_short_description' => 'short', 'products_viewed' => 'Viewed' );
//
// the array format is: array( 'table_field_name' => 'Familiar Name' )
// the array key ('table_field_name') is always the exact name of the
// field in the table. The array value ('Familiar Name') is any text
// name that will be used in the custom EP export download checkbox.
//
// I believe this will only work for text/varchar and numeric field
// types. If your custom field is a date/time or any other type, you
// may need to incorporate custom code to correctly import your data.
//
$custom_fields[TABLE_PRODUCTS] = array(); // this line is used if you have no custom fields to import/export
$custom_fields[TABLE_PRODUCTS_DESCRIPTION] = array(); // this line is used if you have no custom fields to import/export
// ****************************************
// Froogle configuration variables
// Here are some links regarding Bulk uploads
// http://www.google.com/base/attributes.html
// http://www.google.com/base/help/custom-attributes.html
// ****************************************
// **** Froogle product info page path ****
// We can't use the tep functions to create the link, because the links will point to the
// admin, since that's where we're at. So put the entire path to your product_info.php page here
define ('EP_FROOGLE_PRODUCT_INFO_PATH', HTTP_CATALOG_SERVER . DIR_WS_CATALOG . "product_info.php");
// **** Froogle product image path ****
// Set this to the path to your images directory
define ('EP_FROOGLE_IMAGE_PATH', HTTP_CATALOG_SERVER . DIR_WS_CATALOG_IMAGES);
// **** Froogle - search engine friendly setting
// if your store has SEARCH ENGINE FRIENDLY URLS set, then turn this to true
// I did it this way because I'm having trouble with the code seeing the constants
// that are defined in other places.
define ('EP_FROOGLE_SEF_URLS', false); // default is false
// **** Froogle Currency Setting
define ('EP_FROOGLE_CURRENCY', 'USD'); // default is 'USD'
To create your own custom file layouts:
This is not hard, but is more than setting a few config vars. Look in the
function ep_create_file_layout, and happy hacking!
There are more in the config section that are not discussed here. You did
read the entire config section like I suggested, right? ;-)
-------------------------------------------------
VII. USAGE HELP
-------------------------------------------------
1. 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 txt 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:
+ Excel users: as a "Text (tab delimited)" file from Excel
+ Excel users with EP_EXCEL_SAFE_OUTPUT set to true: need to save as DOS-CSV (comma separated (US))
+ OpenOffice users: as a "Text" file, check the "edit MORE HERE"
+ Those with special character needs (such as cyrillic), use Open Office and export as...
(waiting for a response from a user on this one)
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.
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:
1) Go to Admin -> Catalog -> Easy Populate
2) Click the lower browse button and get the file you want to split.
3) 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 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.
SPECIAL INSTRUCTIONS FOR MAC USERS
----------------------------------
Because of the differences in the end-of-line characters used by Apple's operating systems,
after editing and saving the tab-delimited file, you'll need to open the file in BBedit or
equivalent and change the line endings to "Unix".
When the product name contains characters with accents they are translated to other characters
in the database. ó, for example becomes A with a ~ and a superscript 3.
Saving the file as ISO-8859-1 solves the problem. (thanks for BenBogart for this!)
SPECIAL INSTRUCTIONS FOR NON-ROMAN CHARACTER SETS (Thanks for this Richard!)
-------------------------------------------------
If you want to feed your database with cyrillic characters (or any other
ones) I recommend to download Open Office. http://www.openoffice.org/
Open Office gives you the possibility to save a csv-file with the encoding
you need! The OpenOffice application which you shall use for that issue is
CALC. It´s the Open Office äquivalent to Microsoft Excel.
Something general to take care about - Be aware that, if you add another
language the language ID has most probably the "ID-4", even if you deleted one
of the default languages before. So if you include cyrillic fonts to a field
with ID 3 they might not show up then. The easiest way to check that is to
download an easy-populate feed and check the ID like that.
After your Open-Office calc-file contains all the information you need, just
choose "save as" and select "Text CSV" in the dropdown menu. Under the
dropdown-menu check additionally "Filtereinstellungen bearbeiten" (for
german prog-versions) or if you use an english Open Office version, the
checkbox might be labelled like "change filter-settings" or something
similar.
Then press "save" and a pop-up window appears, telling that parts of the
format might be lost.
You press "YES" and you´ll see a next dialog, where you should choose
# encoding (many options)
# seperator for field
# dividing element for text
If you want to feed your database with cyrillic letters, "cyrillic
windows-1251" is pretty standard and might work for you from the scratch.
If not, you shall experiment and try the other encodings. You will see, that
the prog gives you lot`s of different encoding options.
For me the dividing element (seperator) was in any case "semi-colon" even I
had defined "comma" in the easy populate settings!
So if you can´t upload with your defined seperator give that a try.
If you once have your file uploaded and it´s succesful in the database you
shall be aware that if you download the product-file with easy populate you
shall open this csv file in any case by choosing the right encoding in the
opening dialog! That´s important because otherwise you´ll screw up the
encoding.
The process is anyway obvious. Also the right seperator shall be easy to
select, because you see the result in realtime, by choosing the different
options for seperator in the opening dialog.
Then just make your changes and save it like desribed above.
This was the only version which worked for me and I hope it will help the
one or the other lonely nerd, feeding her/his system in the Russian (or any
other) way.
Hope this is understandable enough.
Greetings,
Richard
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 numerically lowest language ID is used to
compare and find the existing cateogry. The remaining category names are updated. English
is ID 1. 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 given
information (price, weight, qty). If it does exist, then the given information is updated.
-------------------------------------------------
VIII. EP 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 you are using Excel Safe Output.
The names of all the fields in order are:
'v_products_model'
'v_products_image'
# 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'
'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
# If you have turned on support for Header Tags Controller the following 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
'v_products_price'
'v_products_weight'
'v_date_avail'
'v_products_quantity'
# If you have turned on support for Separate Pricing Per Customer, the following 2 are available
# Note: these must appear in pairs!! You cannot logically have a price without an ID to apply it to.
'v_customer_price_N' // where N is the ordinal number of groups/prices
'v_customer_group_id_N' // where N is the ordinal number of groups/prices
'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_date_added'
'v_tax_class_id'
'v_status'
'EOREOR'
DESCRIPTION OF COLUMNS
----------------------
'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'
'v_products_url_1'
For each language you have active in your store, you'll get a
pair of name and description for the product
'v_products_price'
Price you want listed. Right now we don't handle anything except retail price
'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' & '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_ITin the configuration constants section of easypopulate.php
Valid entries in this column are:
Active
Inactive
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.
-------------------------------------------------
IX. FROOGLE HELP
-------------------------------------------------
EasyPopulate supports the basic froogle format. You'll need to
contact Google to set up your froogle account. You'll also need
to rename the output file as required by google.
http://google.com/base/help/overview.html
http://google.com/base/products.html
Froogle downloads will include the specials price if one is set
and active and applies to today.
FROOGLE CONFIGURATION
---------------------
To support the froogle export format, you must configure two
configuration variables which should not need changing:
The following should be set to the full address that an external
person would have to type into their browser to go directly to your
product info page. Simplest way to set this is to go look at
a product in your store with your browser, then copy/paste the
url, and chop off everything after 'product_info.php'. (should not need changing)
define ('EP_FROOGLE_PRODUCT_INFO_PATH', HTTP_CATALOG_SERVER . DIR_WS_CATALOG . "product_info.php");
The following should be set to the full address to your images
directory, with the trailing slash. (Again, should not need changing)
define ('EP_FROOGLE_IMAGE_PATH', HTTP_CATALOG_SERVER . DIR_WS_CATALOG_IMAGES);
Once you've set these, test by doing a froogle export, and copy/paste the
product_info url into your browser. Do the same for the image.
Troubleshoot until this works as expected.
-------------------------------------------------
X. OTHER CONTRIBUTION INTEGRATION HELP
-------------------------------------------------
MORE PICS 6 CONTRIBUTION
------------------------
(sorry, ran out of time)
SEPARATE PRICING PER CUSTOMER (SPPC) CONTRIBUTION
-------------------------------------------------
(sorry, ran out of time)
HEADER TAGS CONTROLLER (HTC) CONTRIBUTION
-----------------------------------------
(sorry, ran out of time)
EXTRA FIELDS CONTRIBUTION
-----------------------------------------
(sorry, ran out of time)
CONTRIBUTIONS THAT USE THE products & products_description TABLES
-----------------------------------------------------------------
** Clipped from the top of the easypopulate.php file. See that file for these settings.
// The following setup will allow you to define any additional
// field into the "products" and "products_description" tables
// in your shop. If you have installed a custom contribution
// that adds fields to these tables you may simply and easily add
// them to the EasyPopulate system.
//
// ********************
// ** products table **
// Lets say you have added a field to your "products" table called
// "products_upc". The header name in your import file will be
// called "v_products_upc". Then below you will change the line
// that looks like this (without the comment double-slash at the beginning):
// $custom_fields[TABLE_PRODUCTS] = array(); // this line is used if you have no custom fields to import/export
//
// TO:
// $custom_fields[TABLE_PRODUCTS] = array( 'products_upc' => 'UPC' );
//
// If you have multiple fields this is what it would look like:
// $custom_fields[TABLE_PRODUCTS] = array( 'products_upc' => 'UPC', 'products_restock_quantity' => 'Restock' );
//
// ********************************
// ** products_description table **
// Lets say you have added a field to your "products_description" table called
// "products_short_description". The header name in your import file will be
// called "v_products_short_description_1" for English, "v_products_short_description_2" for German,
// "v_products_short_description_3" for Spanish. Other languages will vary. Be sure to use the
// langugage ID of the custom language you installed if it is other then the original
// 3 installed languages of osCommerce. If you are unsure what language ID you need to
// use, do a complete export and examine the file headers EasyPopulate produces.
//
// Then below you will change the line that looks like this (without the comment double-slash at the beginning):
// $custom_fields[TABLE_PRODUCTS_DESCRIPTION] = array(); // this line is used if you have no custom fields to import/export
//
// TO:
// $custom_fields[TABLE_PRODUCTS_DESCRIPTION] = array( 'products_short_description' => 'short' );
//
// If you have multiple fields this is what it would look like:
// $custom_fields[TABLE_PRODUCTS_DESCRIPTION] = array( 'products_short_description' => 'short', 'products_viewed' => 'Viewed' );
//
// the array format is: array( 'table_field_name' => 'Familiar Name' )
// the array key ('table_field_name') is always the exact name of the
// field in the table. The array value ('Familiar Name') is any text
// name that will be used in the custom EP export download checkbox.
//
// I believe this will only work for text/varchar and numeric field
// types. If your custom field is a date/time or any other type, you
// may need to incorporate custom code to correctly import your data.
//
$custom_fields[TABLE_PRODUCTS] = array(); // this line is used if you have no custom fields to import/export
$custom_fields[TABLE_PRODUCTS_DESCRIPTION] = array(); // this line is used if you have no custom fields to import/export
-------------------------------------------------
XI. TROUBLESHOOTING HELP
-------------------------------------------------
It doesn't work! What should I do?
----------------------------------
First, look for really obvious problems with your file.
1. Did you download a file via EasyPopulate first? If not, do that now.
2. Compare the file you're trying to upload to the file you downloaded.
Look for missing fields. Ignore the quotes, EP won't care about missing quotes.
Open it in a text editor instead of excel. Look for odd characters that shouldn't be there.
3. copy your import file, trim the copy to only 5 import rows and try again. If it works, you may
have a limit to the size of your upload file. See step 5 of the installation and consult your host.
Second, simplify
1. Try uploading the file you just downloaded. If this doesn't work, you've got basic problems,
hit the forum and describe your errors. Please search for your error message first, if there
is no fix, then post a very specific problem report (see the section: "XII. SUPPORT", below).
Don't just tell me "It's broken", or I'm likely to say, "Well, fix it!" 8-)
2. If you can upload the unmodified downloaded file, then try adding just one product to it, and
upload that. Keep it simple, no fancy stuff in the descriptions or anything.
My products aren't in the right categories! What now?
-----------------------------------------------------
Previous versions of EP required that the categories be listed from lowest to highest
level categories. This has changed, and now the categories are from left to right in
the file, highest to lowest level. So if you want your product to end up in:
Rocks ->
Sedimentary Rocks ->
Limestone Rocks
Then your categories should be set like this in the file:
v_categories_name_1 = Rocks
v_categories_name_2 = Sedimentary Rocks
v_categories_name_3 = Limestone Rocks
I don’t see the Custom Export window, all I see is a tiny little box where is should be.
----------------------------------------------------------------------------------------
If you upload the fixed file from /catalog/admin/includes/classes/table_block.php. This should be fixed.
If not you may want to look at this. I (surfalot) truly apologize for introducing this problem by using
this class in the project. Bug has been documented here: http://www.oscommerce.com/community/bugs,2003
# open: /catalog/admin/includes/classes/table_block.php
# find:
if (isset($contents[$i][$x]['text']) && tep_not_null(isset($contents[$i][$x]['text']))) {
# replace line with this
if (isset($contents[$i][$x]['text']) && tep_not_null($contents[$i][$x]['text'])) {
# find:
if (isset($contents[$i][$x]['params']) && tep_not_null(isset($contents[$i][$x]['params']))) {
# replace with:
if (isset($contents[$i][$x]['params']) && tep_not_null($contents[$i][$x]['params'])) {
I try to split a file but it leaves it in one big file, and says zero records were found.
-----------------------------------------------------------------------------------------
Check to be sure that your data includes the 'EOREOR' at the end of every row. EP starts reading
the file and looks for this field in order to split it into rows. If this field is missing, EP
will never find the end of the row of data.
When I try to upload, I get this error:
Fatal error: Call to undefined function: tep_get_uploaded_file() in /home/www/web19/html/catalog/admin/easypopulate.php on line xxx
-----------------------------------------------------------------------------------------
The function isn't being found. Did you copy the easypopulate_functions.php to the admin directory?
I upload a file but it just goes right back to the easypopulate screen without doing anything.
----------------------------------------------------------------------------------------------
Chances are your file is too large to import properly. Either split it, or if it's already split,
then set EP_SPLIT_MAX_RECORDS in easypopulate to something smaller and try again.
The prices in the store are not what I put in the spreadsheet.
--------------------------------------------------------------
Check the EP_PRICE_WITH_TAX configuration constant in the configuration variables section. Change
it to the opposite of what it is (i.e if it's false, set true, if true, set to false), and re-import.
This variable tells EP that the price includes the tax rate or not.
When I try to upload a file, I get warnings like this:
------------------------------------------------------
Warning: Unable to create '/home/html/mati/html/catalog/temp/nuevo.txt': No such file or directory in /home/html/mati/html/tienda/admin/includes/functions/general.php on line 789
Warning: Unable to move '/tmp/phpz24pMf' to '/home/html/mati/html/catalog/temp/nuevo.txt' in /home/html/mati/html/tienda/admin/includes/functions/general.php on line 789
File uploaded.
Temporary filename: /tmp/phpz24pMf
User filename: nuevo.txt
Size: 98039
Warning: file("/home/html/mati/html/catalog/temp/nuevo.txt") - No such file or directory in /home/html/mati/html/tienda/admin/easypopulate.php on line 469
Warning: Invalid argument supplied for foreach() in /home/html/mati/html/tienda/admin/easypopulate.php on line 473
Upload complete
Answer:
EP can't find the file that you uploaded for some reason. Check to see that you
actually have a temp directory at the location shown, and that it is chmod'd
to 777 (chmod 777 temp) on a *nix box, and on windows that everyone has write
permission to that directory. If you do have a temp directory but it's not under
the catalog directory, then you must go into easypopulate.php and set the
EP_TEMP_DIRECTORY constant definition.
If you are doing the "Create txt in temp dir" option and you get errors like this:
----------------------------------------------------------------------------------
Warning:
fopen("/usr/local/plesk/apache/vhosts/yourdomain.com/temp/EP1038000963.csv", "w+")
- No such file or directory in /usr/local/plesk/apache/vhosts/yourdomain/httpsdocs/admin/easypopulate.php on line 273
You have one of two problems:
A)
The permissions are not set correctly for your temp dir.
Fix: ftp in and do a "chmod 777 temp"
Verify by using Tools->Files and go to the temp directory, the perms should read like this "drwxrwxrwx"
-or-
B)
The temp dir path is wrong.
First, check the path that you see in Tools->Files.
Now compare that to the path in the error message.
If they are not the same, edit the EP_TEMP_DIRECTORY constant definition near the top so they will match.
--------------------------------------------
Special characters should be handled OK by EasyPopulate, but it is recommended to use the special
control characters as there are some parts of osC that may not properly strip slashes from the data
if you use the special character instead of the control codes. Try the Excel Safe Output feature if
you haven't already.
--------------------------------------------
Windows users:
If you have trouble downloading and opening the file, try downloading the file.
If you encounter errors here trying to dl the file,
try using the "Create txt in temp dir" link. This
will create a file in the /catalog/temp directory,
which you can get to via the Tools/Files in the
admin area, and download it there.
If you still have problems at that point, well,
there's always ftp. I've beaten my head against this wall too much,
and danged if I'm going to spend more time fussing with a busted browser on a
busted 'operating system'. Bill Gates has stolen enough of my life as it is. Get Mozilla. It works.
It's possible this problem is related to sites that have their admin on the https side.
----------------------------------
-------------------------------------------------
XII. SUPPORT
-------------------------------------------------
Remember that this was written by volunteers, if you have questions, post in the
forums, don't email any of the authors involved, since they may not be supporting
the script any longer! Lives change and people contribute and move on :)
Before you ask a question in the support topic, please, please,
read the entire docs AND at least the last 4-5 pages of the
support topic. Then, search the the topic for your answer.
If you don't understand what a setting is or does, please ask.
Only after that, should you ask for help with an error or problem
USING this contribution. If it is obvious you have not exhausted
all resources to find a solution on your own, you may not get an answer.
Volunteers' time is just as valuable as yours and your commitment to
your customer is your problem. (please make a little effort)
How to ask for help
-------------------
Gather information we need to help you:
1) Set EP_SHOW_EP_SETTINGS to true in the EP settings and then copy the
settings & server info that are displayed on the EP main page into your post.
2) Copy of any error message you are receiving.
3) Post a link to a sample of any upload file you are trying.
Please avoid posting the sample data since the forum may modify it.
4) Place all information in your post. | |