Developer forum

Forum » Development » Wrong Ecom:VariantOption.Selected

Wrong Ecom:VariantOption.Selected

Anders Ebdrup
Reply

Hi Dynamicweb,

 

We have some issues with: Ecom:VariantOption.Selected as the value is not set correctly - see the function here:

        Public Sub RenderVariantOption(ByVal VariantOption As VariantOption, ByVal Template As Template)
            If Template.HtmlHasPartialTag("Ecom:VariantOption") Then
                Template.SetTag("Ecom:VariantOption.ID", VariantOption.ID)
                Template.SetTag("Ecom:VariantOption.Name", VariantOption.Name)
                If _RenderingVariantId.Contains(VariantOption.ID) Then
                    Template.SetTag("Ecom:VariantOption.Selected", True)
                Else
                    Template.SetTag("Ecom:VariantOption.Selected", False)
                End If

 

It checks if the VariantOption.ID is contained in a string, which is wrong as a variantoptionid as "s" is contained "xs". The _RenderingVariantId should be an array which is splitted by "." and then check is the array contains the VariantOption.ID

 

Best regards, Anders


Replies

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

TFS#19403.

Changed to this:

If _RenderingVariantId.Split("."c).Contains(VariantOption.ID) Then

Template.SetTag("Ecom:VariantOption.Selected", True)

Else

Template.SetTag("Ecom:VariantOption.Selected", False)

End If

Votes for this answer: 1
 
Anders Ebdrup
Reply

Thanks :-)

 

You must be logged in to post in the forum