Try our conversational search powered by Generative AI!

Publish Error due to duplicate images

Vote:
 

Using Commerce v 9.11.1:

I'm getting an error when publishing a CatalogEntry- "Column 'CatalogNodeId, CatalogEntryId, AssetType, AssetKey' is constrained to be unique. Value '0, 11483, cms.models.media.LocalizedImageFile, 5e46bf0a-0baa-4b3b-9823-d1151cb0fa35' is already present."

Assets Tab

This error sounds like an image has duplicate relationships to the CatalogEntry, but is clearly not the case. Since there's only one image showing in the tool, I decided to check the database.

SELECT * FROM CatalogItemAsset for my CatalogEntry:

CatalogItemAsset

SELECT * FROM ecfVersionAsset for my WorkId:

ecfVersionAsset

This error is happening for many, but not all, of my CatalogEntries. If I delete the record from CatalogItemAsset but not ecfVersionAsset and then try to publish, the error does not occur and CatalogItemAsset is re-populated.

As far as I can see, I'm afraid I'll have to clear the CatalogItemAsset table and having to manually republish all 30,000 of my CatalogEntries. Obviously I would like to avoid having to do that. And yes, I understand EPiServer doesn't like us making changes in the database but I can't get it to work another way.

Any help would be appreciated.

#174915
Edited, Feb 07, 2017 17:59
Vote:
 

Hi,

I assume that you are getting the error when you publishing via Catalog UI? Can you try to write a small code to publish the entry and what's in your entry's CommerceMediaCollection?

#174918
Feb 07, 2017 20:31
Vote:
 

Is it possible to do a mass publish on all products in a given catalog? How would you do this programatically?

#175090
Feb 10, 2017 17:06
Vote:
 

Currently there is no way to "mass publish" - if you meant batching. The content APIs only allows publishing one by one. Of course you can do that programatically, but for 30.000 content it'll not be fast (or even can be very slow)

However, if you are not using versions, and if you are willing to use ICatalogSystem/Dto approach then it can be done much faster.

#175093
Feb 10, 2017 17:21
Vote:
 

Do you have a code example of either of these methods? I'd like to dive into these as possabilities. 

#175094
Feb 10, 2017 17:28
Vote:
 

From Keith Piotti's post (And you seem to be working in same team) it seems you are using versions, and ICatalogSystem/DTO approach will clear all versions. I suppose that would be a less than optimal approach for you.

The problem should be fixed at its root - I suggest you to contact our developer support service for further assistance. 

#175114
Feb 13, 2017 10:34
* 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.