skip to Main Content

We are attempting to migrate a store from SFCC to Shopify, but we are having trouble exporting the products from Salesforce Commerce Cloud (previously Demandware).

I’ve reviewed quite a bit of documentation from SFCC, but I’m not finding a simple product export. I wonder if I might be misunderstanding their terminology.

I found this cheatsheet:
https://documentation.b2c.commercecloud.salesforce.com/DOC2/index.jsp?topic=%2Fcom.demandware.dochelp%2FImportExport%2FImportExportObjectCheatsheet.html&resultof=%22%70%72%6f%64%75%63%74%22%20%22%65%78%70%6f%72%74%22%20

It pointed me toward “Catalog Object Import/Export”
https://documentation.b2c.commercecloud.salesforce.com/DOC2/index.jsp?topic=%2Fcom.demandware.dochelp%2FImportExport%2FCatalogObjectImportExport.html

When I attempt to export my products, I am missing many product attributes from the export, like custom attributes. How can I get this data too?

2

Answers


  1. Please refer to the sfcc catalog schema from B2C Commerce import and export schemas:

    The schema will explain to you the structure of the catalog. The catalog can have assigned products or catalog can own them. In SFCC we usually have a master catalog that owns products. Owning means that in the catalog you have product definition and all related data about the product, except images.

    Hence what you need to do is to ask your client to export for your master catalog of the site you wish to migrate. Such activity doesn’t require coding or some job creation in SFCC. You can make it from Business Manager following this pass:

    • Merchant Tools > Products and Catalogs > Import & Export > Catalog Export – Step 1: Select Catalog

    Catalog Export

    Note that products in Commerce Cloud have an inheritance model for attributes. Products that have multiple size or color options (or other options) will use a Master -> Variant relationship. Variants will inherit values for attributes from the Master product if their own attributes are empty. For example, you will often see a product’s name attribute defined only for the Master product.

    Login or Signup to reply.
  2. I export all products daily to SQL Server through a C# job. The important parts of the code are below.

    Using OCAPI Data ProductSearch, you would first create a request to see how many total products you have. You can only get 200 products at a time so you have to calculate the total number of times to call the api.

    var countQuery = "{ "query": { "term_query": { "fields": ["id"], "operator": "is_not_null" }}}";
    var countContent = new StringContent(countQuery, Encoding.UTF8, "application/json");
    var urlUri = new Uri(url);
    var countResponse = await client.PostAsync(urlUri, countContent);
    string countResponseString = await countResponse.Content.ReadAsStringAsync();
    
    dynamic countJson = JsonConvert.DeserializeObject(countResponseString);
    int records = countJson["total"];
    // determine number of times to call api, rounding up.
    int calls = (records + (200 - 1)) / 200;
    

    Pull the products 200 at a time in a loop. We use this to compare the list of New and Removed products every day. It is also good to compare products with price changes. Or just to export for other uses.

    for (var i = 0; i < calls; i++)
    {
    
        var query = "{ "query": { "term_query": { "fields": ["id"], "operator": "is_not_null" } },"select":"(**)","expand":["all"], "start": " + i * 200 + ", "count": 200 }";
        var content = new StringContent(query, Encoding.UTF8, "application/json");
        var response = await client.PostAsync(urlUri, content);
        string responseString = await response.Content.ReadAsStringAsync();
    
        dynamic json = JsonConvert.DeserializeObject(responseString);
    
        Console.WriteLine("DW products status: " + i * 200 + " records.");
    
        foreach (var obj in json.hits)
        {
          // Do stuff (create csv, write to db, etc)
        }
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search