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

 
Roald Haahr
Reply

Hi Adrian and Nicolai,

I am following the guide above and have encountered two problems on a Swift v1.19.0 project running DW v9.15.4

  • If I attach a product group to the parts list, the product details page will not load, and it gradually takes up alle available memory on our server, so it might be a bug. If I only attach single products, the product details page loads normally.
  • If I change the number of attached products in the parts list, the number om BOM items on the product details page will not update until I recycle the app pool. Might be another bug.

Have either of you experienced similiar problems and if so, how did you solve it?

And Adrian, did you manage to implement the BOM functionality into Swift, or did you face any problems along the way?

Kind regards,
Roald

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Roald,

I have managed to implement it following Nicolai's suggestion without any issues.

I have not encountered anything similar to what you are describing. In my case, the version was 9.13.12. I am not sure if it has any relevance.

Adrian

 

You must be logged in to post in the forum