Commerce Catalog Import API - Issue with EntryRelations

Vote:
 

Hi there!

We are checking some strange behavior in our Catalog Import process, and I have found something in the Epi code that I would like to see if anyone has experience the same.

Let's assume the following scenario:

  • We have Products and Variants.
  • We have a product with the Code: 911819619
  • We have two variants with codes 670097 and 680255.
  • There is a EntryRelation (ProductVariation) between 911819619 and 670097.

Attached you can find the DB queries in a screenshot.

We now want to add a new EntryRelation, between the Product 911819619 and the second variant 680255.
So, we prepare the following XML file and use the CatalogImport API (Mediachase.Commerce.Catalog.ImportExport.Import).

<?xml version="1.0" encoding="utf-8"?>
<Catalogs xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Catalog name="Products" lastmodified="2020-10-07T01:03:37.9880275Z" startDate="2020-10-07T01:03:37.988029Z" endDate="2040-10-07T01:03:37.9880304Z" defaultCurrency="usd" weightBase="lbs" defaultLanguage="en" sortOrder="0" isActive="true">
<Nodes totalCount="0">
</Nodes>
<Entries totalCount="0">
</Entries>
<Relations>
<EntryRelation isActive="true">
  <ParentEntryCode>911819619</ParentEntryCode>
  <ChildEntryCode>680255</ChildEntryCode>
  <RelationType>ProductVariation</RelationType>
  <Quantity>0</Quantity>
  <GroupName>default</GroupName>
  <SortOrder>0</SortOrder>
</EntryRelation>
</Relations>
<Associations>
</Associations>
</Catalog>
</Catalogs>


After we run the import, nothing happens and the new relation is not being added.

While digging into the code in the Import, I found something that called my attention in the EntryRelationsReader.cs


It seems that if the Parent Entry already has a RelationType (in this case "ProductVariation") existing for any other item, the relation is not added (since it seems it goes to the else section).

I have confirmed this while doing some testing, for instance, removing the existing relation and adding both of them together in the XML seems to be working fine.

This is Commerce 13.23.X

Is anyone aware of an issue here?
Maybe this is done due to a restriction that I may not be aware?

Thanks,
Mauro.

#229643
Edited, Oct 20, 2020 21:38
Vote:
 

This looks like a newly introduced bug to me. I will file a bug to Commerce team. Thank you for bringing this to our attention and apologies for any inconveniences it caused.

#229673
Oct 21, 2020 8:03
Peter Wind - Nov 27, 2020 11:01
Any news on this bug Quan?

We are apparently experiencing the same (https://world.episerver.com/forum/developer-forum/Episerver-Commerce/Thread-Container/2020/11/catalog-import-some-entryrelations-are-not-imported/?_t_id=hc8kmOhkmHOQaWOzz0NvPQ%3d%3d&_t_uuid=PhYTPjEHQ7WTiP18280I2A&_t_q=entryrelation&_t_tags=language%3aen%2csiteid%3a4ba62c03-2627-4a1e-8939-9db6098db0eb%2candquerymatch&_t_hit.id=EPiServerWorld_ContentTypes_WebFormTypes_ThreadPageType/_cdddf79c-8b25-463c-b2d7-2d20e3dde381_en&_t_hit.pos=1)
Vote:
 

I think we can do some workaround in the meantime.

Thanks Quan!

#229695
Oct 21, 2020 14:35
Vote:
 

The bug (COM-12349) is now fixed and is waiting for release. 

#231431
Nov 27, 2020 11:01
Peter Wind - Nov 27, 2020 11:03
Thank you Quan - Do you have a best guess on when we can expect it to be released?
Quan Mai - Nov 27, 2020 11:05
I don't know, ping-ed Commerce team about it. Maybe 2 weeks, maybe a bit longer. it's up to them now
Vote:
 

For anybody having the same issue - The fix was released in the end-of december and we have just confirmed that it works in our solutions.

#246427
Jan 05, 2021 19:13
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.