Service API - Catalog bulk import - How to import to Block properties?

Drew Null
Member since: 2013

I'm using the Service API's catalog bulk import service to import a catalog via XML files. My, say, Product class has a property that is a block, and I would like to import data into the property block's properties. 

For example, say I have a Product type with an Address property that is an AddressBlock (this is not a real example)... 

[ContentType( ... )]
public class AddressBlock : BlockData
    [Display( ... )]
    public virtual string Line1 { get; set; }

    [Display( ... )]
    public virtual string City { get; set; }

    [Display( ... )]
    public virtual string State { get; set; }

    [Display( ... )]
    public virtual string Zip { get; set; }

[CatalogContentType( ... )]
public class Product : ProductContent
    [Display( ... )]
    public virtual AddressBlock Address { get; set; }

How would I import the address properties via the catalog bulk import? The XSD-generated classes aren't giving me any clues. 

#183709 Edited, Oct 20, 2017 5:09
  • Quan Mai
    Member since: 2011

    The block will be saved in XHTML property like this

    <div data-classid="36f4349b-8093-492b-b616-05d8964e4c89" data-contentguid="44748655-f81e-4e3d-910a-5e11b273f8ac" data-contentname="New Block">{}</div>

    So if you can just export and import as normal. However you will also to export and import CMS content (which includes the blocks) to make the properties work.

    #183796 Oct 23, 2017 16:37