Developer forum

Forum » Ecommerce - Standard features » License max product calculations

License max product calculations

Arnór Halldórsson
Arnór Halldórsson
Reply

Hi,

When checking how many products the customer has towards his license cap, does Dynamicweb count each variant into the amount instead of just the number unique ProductIds?

Best regards,
Arnór


Replies

 
Nicolai Pedersen
Reply

Counting SKUs which is unique product numbers.

 
Arnór Halldórsson
Arnór Halldórsson
Reply

Hi Nicolai,

Ok so basicly: SELECT ProductNumber, ProductVariantId FROM EcomProducts GROUP BY ProductNumber, ProductVariantId; ?

We have a customer that has a pretty messed up variant setup, and it appears that they've exceeded their Max product limit so I'm trying to figure out if it's because of the messed up variants or if it's legit.

Best regards,
Arnór

 
Nicolai Pedersen
Reply

Hi Arnor

This is the actual code:

public static int NumberOfUniqueVariantCombinations()
        {
            var commandBuilder = new CommandBuilder();
            commandBuilder.Add("SELECT COUNT(*) as SkuCount FROM ");
            commandBuilder.Add("(");
            commandBuilder.Add("SELECT COUNT([ProductID]) as LanguageCount, [ProductID], [ProductVariantID] FROM EcomProducts");
            commandBuilder.Add("group by productid,[ProductVariantID]");
            commandBuilder.Add(") combinations");
            return Converter.ToInt32(Database.ExecuteScalar(commandBuilder));
        }
 
Arnór Halldórsson
Arnór Halldórsson
Reply

Great, muchos gracias.

One more question then I'll scurry back to my cave:

Are we subtracting the amount of "head products" in a variant set from this amount before actually checking if the customer exceeded the limit?

F.e. a product with 4 variants has 5 rows in the EcomProducts table, the first one is just a definition for the product set but we don't keep any stocks for that row. Not that it would make any difference in the case of this customer, but it could for someone else, f.e. if I filter out the head products in this db the difference is around 4600 Skus.

Best regards,
Arnór

 
Nicolai Pedersen
Reply

A master with 4 variants count as 5 because they have different productid/variantid combinations.

 
Arnór Halldórsson
Arnór Halldórsson
Reply

Yes that's my point :) 

I was just wondering whether or not it would make sense to exclude the master row from the count since it's the other 4 variant rows that represent the physical products.

 

You must be logged in to post in the forum