Skip to main content

Serialization

The configuration created by a user can be serialized to a JSON object to be communicated to a webshop cart; or to be saved to storage to reload a product, to a pre-configured state (presets).

Saving configuration

Saving the configuration will create a thumbnail of the 3D rendered product (which can be used by webshop cart), provide representable specifications (visible and selected attributes by user) and a snapshot of attribute’s state for internal reloading purposes.

window.expivi.saveConfiguration(width, height) : Promise<ConfiguredProductOptions[]>;
Parameter Descriptions
ParameterDescriptionType
widthThe width of the thumbnail to be created.number
heightThe height of the thumbnail to be created.number

Return a promise which resolves an array of ConfiguredProductOptions

ConfiguredProductOptions Object Structure
PropertyDescriptionType
versionInterface versionstring
catalogue_idProduct’s IDstring
thumbnail(Optional) Thumbnail as base64 datastring
configurationConfiguration state for internal usage{ attributes: AttributeSerializedValue[] }
attributesRepresentable product specificationsAttributeSerializedValue[]
articles(Optional) Bill of materialsProductArticleModel[]
AttributeSerializedValue Object Structure
PropertyDescriptionType
attribute_idAttribute’s ID in the databasenumber
attribute_name(Optional) Attribute’s name (product specification name)string
attribute_value_name(Optional) Attribute value (product specification value)string
ProductArticleModel Object Structure
PropertyDescriptionType
models_id(Optional) Component’s ID in the databasenumber
models_skuPart’s SKUstring
material_group_id(Optional) Applied material’s ID in the databasenumber
material_group_sku(Optional) SKU of applied material on partstring
price_sku(Optional) Price identifier to look into the pricing matrixstring
price_fieldsCalculated total price for each predefined field{[key: string]: number}
Example call
window.expivi.saveConfiguration(256, 256).then(function(aSaveResults){
console.log("products thumbnail: ", aSaveResults[0].thumbnail);
console.log("products specifications: ", aSaveResults[0].attributes);
console.log("products articles: ", aSaveResults[0].articles);
});