Developer forum

Forum » Development » Property isVariantMaster not working?

Property isVariantMaster not working?

Rob Lohmann
Reply
We're trying looping through a set of products and we want to determine if the current product is a mainproduct and has variants. We wan't to exclude the mainproducts from our overviewpage when variants exist. We used the property product.isVariantMaster, but it always seems to return false.

Is this property not working correctly?

As a work around we use the rule of code below.
Dim bIsMaster As Boolean = myProduct.VariantGroupCnt > 0 AndAlso myProduct.VariantID = ""
Kind regards,
Rob

Replies

 
Morten Snedker
Reply
This post has been marked as an answer
 Hi Rob,

The property looks like this:

        Public ReadOnly Property IsVariantMaster() As Boolean
            Get
                Return Me.VariantID = "" AndAlso Me.VariantCnt > 0 AndAlso Me.VariantGroupCnt > 0
            End Get
        End Property

So, the only difference is the myProduct.VariantCnt part that is missing. This property gets it value from column ProductVariantCounter on table EcomProducts.

 

I don't know if this information answers your question, as to why it returns false?

Regards /Snedker

Votes for this answer: 0
 
Jurgen van Kreij
Reply
 Hi Morten,

You are right, it is better to test also if a variant-product for that master exists. Because if it doesn't, we need to show the master product.

Altough I think the test for VariantGroepCnt can be ommitted. It can't be 0 when the variantCnt >0. Or am I wrong?

IsVariantMaster should work, we test it tomorrow.

Kind regards, Jurgen



 

You must be logged in to post in the forum