Developer forum

Forum » Swift » Swift and BOM products

Swift and BOM products

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I see that BOM products are not yet supported in Swift.

Until this comes to a Swift version, what would be the best approach for listing BOM parts on ProductDetail page?

Thank you,

Adrian


Replies

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Anybody?

 
Nicolai Pedersen
Reply

Product viewmodel does not yet support BOM, so you have to use the old product catalog for rendering that specific part. You can do that in Swift.

  • Add the attached template to: /Templates/Designs/Swift/eCom/Product
  • Create a paragraph on the details page with the old product catalog - yes it can co exist with the new one.
    • It will react on the ProductID=123 and get you the right product
    • This module instance will take care of BOM rendering - everything else is handled by the viewmodel version.

 

 

Select the attached bom template on the paragraph for product detail:

That should get you going.

The attached template is from a Swift project - it does some weird stuff with newtonsoft - but should be usable as a starting point.

BR Nicolai

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

Thank you for the suggestion.

I have found that template in the meantime.

One more thing that I am missing is a way to identify the ProductType (if it is a BOM product) when using ProductViewModel. I dont see that property available and I have no idea how to identify it.

Thank yu,
Adrian

 
Nicolai Pedersen
Reply

Just ask the product service for the product and take a look at the Type of that instance. The service has just loaded the product, so it is in cache and should be ok performance wise to get it.

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

Perfect!

Thank you,
Adrian

 

You must be logged in to post in the forum