Developer forum

Forum » Ecommerce - Standard features » How do I add variants as BOM items from a BOM configurator

How do I add variants as BOM items from a BOM configurator

Roald Haahr
Reply

Hi,

On a standard Swift 1.21.0 (DW 9.15.6) I have created 4 BOM products. I have then made it possible to select BOM items by following this forum post. While three of products works as intended, one of them does not. It is marked in Image 1 below. On that product I have selected a group with variants as a BOM item. The user should be able to select a variant and add to cart, but I cannot figure out how to do that. In Image 2 you’ll see the code that generates the dropdown shown in Image 3. The code in Image 2 works for products without variants, as it is using @configproduct.GetString("Ecom:Product.ID") as value for the options. However, if I want to add a variant, it will add the variant’s master product with the BOM product instead, which makes perfect sense. So I have tried a few options to get around this:

  • Setting the value of the option to @configproduct.GetString("Ecom:Product.Number") – does not work, which makes sense as multiple products can have the same product number. It adds the first product in the list no matter what is selected.
  • Setting the value of the option to @configproduct.GetString("Ecom:Product.CompareID") – does not work. As the CompareID is unique for each variant, it would make sense that this could be used to identify variants in the BOM configurator. It adds the first product in the list no matter what is selected.

 

I hope there is a solution to this. I have faced this problem on two projects now - a Rapido running 9.12.5 and a Swift running 9.15.7.

Kind regards,
Roald

 

Image 1

 

Image 2

 

Image 3


Replies

 
Roald Haahr
Reply

Bump

 
Roald Haahr
Reply

Bump :)

 
Roald Haahr
Reply

Bump

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Roald

That took a bit of digging.

Seems like you can do 

<option value="{productid}|{variantid}"> - so seperated by |

Votes for this answer: 1
 
Roald Haahr
Reply

Hi Nicolai,

Sounds good - I will give it a try :)

 
Roald Haahr
Reply

It works - Thanks Nicolai!

 

You must be logged in to post in the forum