SilverCart Forum
We moderate this Forum and we're here to help. Have you already run a forum search to check if your problem has already been solved?
You can help us helping you by providing detailed error messages, screenshots and logfile entries.
Page: 1 | ||
Topic Importing products via CSV | 2196 Views |
Importing products via CSV
8 April 2013 at 3:14amHi all,
I am having a couple of problems importing products using CSV (1.3.6).
The mechanism I am using is to add some products via the CMS, export the template as a CSV and then add/edit new products based on this using a spreadsheet.
I can export the CSV, edit existing products in the CSV file, and then reimport with no problems.
However, if I duplicate an existing product in the CSV file (in order to create a new product), edit the new line to give it a new ID, etc., and reimport I only get the same number of products I started with, i.e., no new products are added—the last entry overwrites the last product. For example, if I started with 3 products in the CMS, export as CSV, add a fourth line with new ID, and reimport the CSV I still only have 3 products with the last line overwriting the 3rd product. Is there some other Product identifier that doesn't get exported in the CSV file but is necessary to make a unique new product?
Also, I have added some new fields to Product. I can get some of these fields to import by adding a new column in the CSV file, but anything involving Money (with an Amount and Currency) doesn’t work—even if I duplicate existing columns (PriceNetAmount and PriceNetCurrency, for example) and rename the headers. Is there something special I need to do for Money fields?
Thank you.
Graeme
Re: Importing products via CSV
8 April 2013 at 11:53amHi,
I have managed to get the Moneyfields working but still don’t know why they didn't work to start with.
However, I would still like an answer to the first problem: can I add new products via a CSV file or do I need to create the Products first and then add/change the data? In which case, should I just hack the PHP files that create the example data?
Thanks again,
Graeme
Re: Importing products via CSV
11 April 2013 at 9:34amHello Graeme,
regarding the import issue:
The SilverCart bulk loader tries to update existing products. To determine if a product is already present, the following fields get checked for equality:
- ID
- EANCode
- ProductNumberManufacturer
- ProductNumberShop
If any of those fields matches a database record, that record will get updated instead of creating a new one.
The fields to check are set in the file "silvercart/code/backend/SilvercartProductCsvBulkLoader.php" in line 43 (public static $match_existing_fields).
You could try to overwrite them in your projects "_config.php":
SilvercartProductCsvBulkLoader::$match_existing_fields = array(
'ID'
);
Greetings,
Sascha