Hi everyone !
I would like to use a csv file including prices for items, this file will be updated via ftp, I'd like to know how to include the price in episerver trade, create products in catalogs?
Thanks for your help !
The answer is more that one sentence, but in general what you should do is to create mapping xml files which will describe mapping from CSV file structure to corresponding entities in the Commerce. "Product" may consist of more that just one record in DB. It may be product or variation, ir may have records in inventory (stock availability), pricing, associations and even SEO settings, etc.
I would recoemmend you to look in Commerce Manager -> Catalog Management -> Import / Export -> CSV Import Catalog. Using this section you are able to "train" import process to understand your CSV file structure and map CSV data to Commerce entities.
You can get more info in this guide: http://webhelp.episerver.com/Commerce/1.2/#User%20Guide/CatalogManagement/Using%20CSV%20Files%20to%20Quickly.htm
Tks for your answer.
DO you have any examples of doing this as an import via a webservice - I need to find a way how to set up the new products, thier variants together with Prices and Inventory.
I bet that "via webservice" would be pretty lenghty reply, but I can share snippet for creating products and part of sales prices under inventory:
var entry = CatalogContext.Current.GetCatalogEntryDto(importEntry.EntryCode, catalogEntryResponseGroup);
var entryRow = entry.CatalogEntry.Count == 0 ? entry.CatalogEntry.NewCatalogEntryRow() : entry.CatalogEntry;
var inventoryRow = entry.Inventory.Count == 0 ? entry.Inventory.NewInventoryRow() : entry.Inventory;
// do stuff with entry
entryRow.ApplicationId = AppContext.Current.ApplicationId;
entryRow.CatalogId = catalogId;
entryRow.Code = entryCode;
entryRow.Name = entryName;
// create or update variation data
var variationRow = entry.Variation.Count == 0 ? entry.Variation.NewVariationRow() : entry.Variation;
variationRow.CatalogEntryId = entryRow.CatalogEntryId;
variationRow.ListPrice = importEntry.UnitPrice.GetValueOrDefault(0);
variationRow.MaxQuantity = 100;
// update inventory
inventoryRow.ApplicationId = AppContext.Current.ApplicationId;
inventoryRow.SkuId = skuId;
inventoryRow.AllowBackorder = true;
// save entry
Also you need to bind associations between entry and any other catalog nodes if needed. Following code snippet should give you some hints:
// add association
private CatalogRelationDto.NodeEntryRelationRow AddNodeRelation(
var nodeRelation = relation.NodeEntryRelation.NewNodeEntryRelationRow();
nodeRelation.CatalogId = catalogId;
nodeRelation.CatalogEntryId = catalogEntryId;
nodeRelation.CatalogNodeId = catalogNodeId;
nodeRelation.SortOrder = importEntry.SortOrder.GetValueOrDefault(0);
if (this.schema.IsSortOrderSupplied && importEntry.SortOrder.HasValue)
nodeRelation.SortOrder = (int)importEntry.SortOrder;
When it comes to "via webservice" - my guess is that this is just a matter of *where* exactly import logic is located and who is initiator of the process. Other than that - Commerce logic and code should remain the same regardless via which "integration interface" products are pushed into the commerce db...
HI, this is great. Many thanks.