Importing Inventory From A CSV File
Location: Shortcut to Homepage / Free CubeCart 3 Mods / Importing Inventory From A CSV File
Importing Inventory From A CSV File

This is for CubeCart 3. 

This isn't a mod, its instructions on how to import your inventory from a spreadsheet into your CubeCart database.

Note:

These instructions are for advanced users only. You will need to have significant experience with phpMyAdmin, databases & tables, spreadsheets and CSV files.

Anyone who is not proficient in all of the above, please contact Sir William in the CubeCart forums as he has been working on a CSV import mod for CubeCart 3.

Instructions:

Your inventory and categories can be setup within a spreadsheet. It is important that you setup your spreadsheet with the exact same columns as exists in your database tables: CubeCart_inventory and CubeCart_category. The easiest way to do this is to first export these two tables to CSV files, and then open these CSV files with your spreadsheet program.

In order to import your spreadsheet data into your database, you will need to create two files - categories.csv which contains all of your categories in CSV format, and inventory.csv which similarly contains your inventory. These two files can be created by using the Export or Save As command from within your spreadsheet program, and saving as a CSV file. You should specify that a comma (,) be used as the field delimiter, and strings be enclosed by double qoutes (") (other formats are acceptable but you will need to modify the SQL commands below). You can also have one row at the top which defines the field names, and this first row can be ignored when the file is imported into your database (but if you don't have this row, you will to remove the IGNORE 1 LINES from the following SQL commands).

SQL commands:

-- Categories
LOAD DATA LOW_PRIORITY LOCAL INFILE 'C:/path-to-file/categories.csv'
REPLACE INTO TABLE CubeCart_category
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\\'
LINES TERMINATED BY '\r\n' STARTING BY ''
IGNORE 1 LINES;

-- Products
LOAD DATA LOW_PRIORITY LOCAL INFILE 'C:/path-to-file/inventory.csv'
REPLACE INTO TABLE CubeCart_inventory
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\\'
LINES TERMINATED BY '\r\n' STARTING BY ''
IGNORE 1 LINES;

-- Product's Categories
TRUNCATE TABLE CubeCart_cats_idx;
INSERT INTO CubeCart_cats_idx (productid, cat_id) SELECT productid, cat_id FROM CubeCart_inventory;

  Add to Registry Add to Wish List Price: AU$0.00


  Related Products


Copyright © 2005 - 2011 Estelle WinterfloodVPS Hosting by Linode