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
Parameter | Description | Type |
---|---|---|
width | The width of the thumbnail to be created. | number |
height | The height of the thumbnail to be created. | number |
Return a promise which resolves an array of ConfiguredProductOptions
ConfiguredProductOptions Object Structure
Property | Description | Type |
---|---|---|
version | Interface version | string |
catalogue_id | Product’s ID | string |
thumbnail | (Optional) Thumbnail as base64 data | string |
configuration | Configuration state for internal usage | { attributes: AttributeSerializedValue[] } |
attributes | Representable product specifications | AttributeSerializedValue[] |
articles | (Optional) Bill of materials | ProductArticleModel[] |
AttributeSerializedValue Object Structure
Property | Description | Type |
---|---|---|
attribute_id | Attribute’s ID in the database | number |
attribute_name | (Optional) Attribute’s name (product specification name) | string |
attribute_value_name | (Optional) Attribute value (product specification value) | string |
ProductArticleModel Object Structure
Property | Description | Type |
---|---|---|
models_id | (Optional) Component’s ID in the database | number |
models_sku | Part’s SKU | string |
material_group_id | (Optional) Applied material’s ID in the database | number |
material_group_sku | (Optional) SKU of applied material on part | string |
price_sku | (Optional) Price identifier to look into the pricing matrix | string |
price_fields | Calculated 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);
});