Developer forum

Forum » Ecommerce - Standard features » Duplicate units

Duplicate units

Mark Preisler
Reply

Hey

We have a problem with duplicate units, and found this SQL query from the debug tool, it looks like when joining on EcomVariantGroups. The
LanguageId is missing in the where clause. (EcomVariantGroups.VariantGroupLanguageId = @p0) results in duplicate units in the output.

 
DECLARE 
 
@p0 NVARCHAR(5) = N'LANG1', 
@p1 NVARCHAR(6) = N'275020', 
@p2 NVARCHAR(4000) = N'', 
@p3 NVARCHAR(1) = N'1'
 
SELECT EcomVariantsOptions.* 
FROM EcomVariantsOptions 
INNER JOIN EcomVariantGroups ON EcomVariantGroups.VariantGroupID = EcomVariantsOptions.VariantOptionGroupID 
INNER JOIN EcomStockUnit ON EcomStockUnit.StockUnitID=EcomVariantsOptions.VariantOptionId 
WHERE 
EcomVariantsOptions.VariantOptionLanguageID = @p0 
AND 
EcomStockUnit.StockUnitProductID = @p1 
AND 
StockUnitVariantID = @p2 
AND 
EcomVariantGroups.VariantGroupUnit = @p3 
ORDER BY VariantOptionSortOrder, VariantOptionId 

Replies

 
Nicolai Pedersen
Reply

Hi Mark

How did you get the data in?

Usually the options for unites have 2 different group ids - one for each language. See attachment.

You might also have a situation where the same unit is in 2 different stock locations - that would also give 2 records. 

Can you ellaborate a bit on the context - how and where does this happen - what is your unit data for this product?

Thanks, Nicolai

Capture.PNG
 
Mark Preisler
Reply

Hey Nicolai

The data is coming from a data integration, Ecom Provider.

But it might just be me there is confused by the primary key on EcomVariantGroup table containing VariantGroupLanguageId.
Renaming the VariantGroupId or deleting the row will help removing the duplicate units. :)

 
Nicolai Pedersen
Reply

Hi Mark

That means you solved it? (And yes units in variant group and they keys are confusing... Sorry!)

BR Nicolai

 
Mark Preisler
Reply

Hey Nicolai

Yes thanks, it works now.

 

You must be logged in to post in the forum