4.2 - BOM
BOM stands for "Bill Of Material". It's a set JSON object containing the description of the current product, with the data required for an "Add to cart" action for example.
Event name | Input / Output | Payload | Reason |
---|---|---|---|
getBom | Input event | None. | Request the BOM for the current state. |
bom | Output event | See the description below. | Receive the requested BOM. |
Exampleβ
// Receive the BOM.
configurator.addEventListener("bom", (event) => {
console.log(event.detail);
});
// Send a request to get the BOM.
configurator.dispatchEvent(new CustomEvent("getBom"))
Payload descriptionβ
The BOM is a complex JSON object. At the top level, it contains the following attributes:
Attribute name | Type | Content |
---|---|---|
packs | Array of BOM object data. π | If some pack were detected in the BOM, they will appear here. |
products | Array of BOM object data. π | This will contain the product currently loaded. |
totalPrice | The Total price data. π | This object contains the total price of the current product. |
BOM Object dataβ
This is the description of a product or sub product.
Attribute name | Type | Content |
---|---|---|
children | Array of BOM object data. π | Sub products of this product. |
clientMetadata | any | Client metadata for this product. |
commercialDescription | string | Commercial description. |
dbID | string | Identifier of this product in the database. If you load the same product multiple times, the dbid will be the same. |
depth | number? | Product current depth value. |
endDate | string? | End date of the product availability (timestamp). |
freeTags | Array of string | Array of free tags associated to the furniture. |
height | number? | Product current height value. |
isExpired | boolean | True if the product was expired at the time of BOM generation. |
name | string | Product name. |
packs | Array of BOM object data. π | See packs description. π |
parameters | Optional Parameter values. π | The optional list of parameters applied on this product. |
price | Optional Product price. π | An optional price for this product. |
priceExtra | number | An optional value to add to the price. All values are valid, even negative one (to reduce the total price). |
priceMultiplier | number | A multiplier to apply to the price. It should be >= 0. 0 would put all prices to 0. |
recognizedBlock | Optional BOM object data. π | The recognized block, if blocks are configured. |
reference | string | Product reference. |
shortDescription | string? | Short description of the product. |
startDate | string? | Start date of the product availability (timestamp). |
thumbnailURLSmall | string? | Product thumbnail (size 64). |
typeID | number | Product closed tag ID of the product. |
uuid | string | A unique random identifier for this instance of the product. |
width | number? | Product current width value. |
Dimensionsβ
The depth
, height
and width
attributes contains:
- For a simple configurable product π or a module π in a modular composition, the current value of the parameter of the same id (
depth
,height
orwidth
). - For a modular context π: the computed dimensions for the scene, as displayed by the dimensions button.
Product priceβ
This is the description of the price of a product. It contains the following attributes:
Attribute name | Type | Content |
---|---|---|
current | Price Data. π | The computed current price. Can be the same as the regular price. |
discountType | string | The type of the current price. "regular", "reduced", "discounted" or "membership" |
ecoFee | Optional Price Data. π | The current applied ecofee. |
regular | Price Data. π | The computed regular price. |
Price dataβ
This is the description of a price.
Attribute name | Type | Content |
---|---|---|
totalValue | number | The value for this price once any multiplier or price extra is applied. |
type | string | The type of the current price. "regular", "reduced", "discounted" or "membership" |
value | number | The value for this price, without any multiplier applied. |
startDate | string? | Optional. The date at which this price starts being available. |
endDate | string? | Optional. The date at which this price availability ends. |
The start and end date format should follow the Date time string format. π
Total priceβ
This is the description of the total price of the current product.
Attribute name | Type | Content |
---|---|---|
currency | string | The currency to use, a 3 letters string following ISO 4217 π |
current | number | The computed current price. Can be the same as the regular price. |
discountType | string | The discount type of the current price. "regular", "reduced", "discounted" or "membership" |
regular | number | The computed regular price. |
startDate | string? | Optional. The date at which this price starts being available. |
endDate | string? | Optional. The date at which this price availability ends. |
The start and end date format should follow the Date time string format. π
Packsβ
If some products are bought by packs, like "A box of two sofa legs", they will appear in the "packs" attribute. Their description will contain the same data found in a BOM object π, with those additional attributes:
Attribute name | Type | Content |
---|---|---|
quantity | number | Number of packs products needed for the project |
Recognized Blockβ
If blocks are configured π, the BOM can contain a recognized block. The recognized block object contains the same data found in a BOM object π, with small differences:
- The "children" attribute of the recognized block will contain only additional products. π
- The recognized block will not have another recognized block inside.
When a product has a recognizedBlock attribute filled, the children of this product will still be available, but they will have no price. They are only useful if you want the full description of the composition. The price of the composition will make use of the recognized block price and the additional products prices.
Parameter valuesβ
This only contains data if you enable the associated ParameterBOMRule. π The rule will configure a list of parameters that must be displayed in the BOM.
When the rule is correctly configured, this is an object where the attribute names are the parameter ids. For each attribute, the value is the current value for the parameter.
Default parameter valuesβ
When the rule does not enable product details, the parameter targeting a product will contain the database identifier of that product.
{
"seat_width": 120,
"finish": "blue_fabric"
}
Detailed parameter valuesβ
When the rule enables product details, the parameter targeting a product will contain a product object with more commercial data. That product object contains the same data found in a BOM object π, except for the following attributes:
children
parameters
recognizedBlock
uuid
packs
{
"seat_width": 120,
"finish": {
"dbID": "blue_fabric",
"reference": "blue_fabric",
"name": "Blue fabric",
"typeID": 1,
"freeTags": [],
"commercialDescription": "Blue fabric",
"shortDescription": "Blue fabric",
"thumbnailURLSmall": "url to thumbnail",
"startDate": null,
"endDate": null,
"isExpired": false,
"clientMetadata": null,
"priceMultiplier": 1,
"priceExtra": 0
}
}