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."
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:
SELECT * FROM ecfVersionAsset for my WorkId:
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.
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?
Is it possible to do a mass publish on all products in a given catalog? How would you do this programatically?
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.
Do you have a code example of either of these methods? I'd like to dive into these as possabilities.
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.