Delete Entry or CatalogNode via API


Any way to delete CatalogEntries easily (without going through each of the relating tables and delete its relations)?!?!


Same question for CatalogNodes? Any easy ways of deleting an entire catalog node including related catalog entries?

Apr 16, 2013 12:10

Mediachase.Commerce.Catalog.Managers.CatalogNodeManager and CatalogEntryManager Classes have related Functions as 

DeleteNodeRecursive or DeleteCatalogNode.

Apr 16, 2013 12:30

1) these classes you mention are all static with internal only methods, so no way to use them directly.
I guess the implementation of ICatalogSystem (CatalogContext.Current) uses these classes to do their stuff. 

2) ICatalogSystem.DeleteCatalogEntry(int entryId, bool recursive) does not delete the entries even if recursive is true. The method just moves the entries to the catalog root (i guess if i delete them again from here they will eventually be removed from the database, but there must be a better solution).


Apr 17, 2013 9:37

Try public functions available in  Mediachase.Commerce.Catalog.Impl.CatalogContextProxyImpl or Mediachase.Commerce.Catalog.CatalogContext.Current.DeleteCatalogEntry

Edited, Apr 17, 2013 9:48

But Khan ... you get a ICatalogSystem from Mediachase.Commerce.Catalog.CatalogContext.Current (which i expect is implemented using Mediachase.Commerce.Catalog.Impl.CatalogContextProxyImpl), so my previous post already explained that this does not work.

The problem is that DeleteCatalogEntry deletes the relations but not the entry it self, which is silly.

Apr 17, 2013 12:22

Sorry Palle, You are right. I am sure it works as once i have used this. but not sure about recursive. Can you please test by setting recursive=false.

It should remove Relations, Asoociations, Inventory and Entry in itself.

if it works fine then you probably can iterate for each entry.

Apr 17, 2013 12:38


how to insert entry in catalogNode ?


Apr 18, 2013 11:54

Perhaps you should have started a new thread.

But existing entry is related to a catalogNode using:

                    CatalogRelationDto relation = null;
                    relation = CatalogSystem.GetCatalogRelationDto(_catalogId, node.CatalogNodeId, newEntryRow.CatalogEntryId, "",
                        new CatalogRelationResponseGroup(CatalogRelationResponseGroup.ResponseGroup.NodeEntry));

                    CatalogRelationDto.NodeEntryRelationRow nodeRelation = null;
                    if (relation == null || relation.NodeEntryRelation.Count == 0)
                        nodeRelation = relation.NodeEntryRelation.NewNodeEntryRelationRow();
                        nodeRelation.CatalogId = _catalogId;
                        nodeRelation.CatalogEntryId = dto.CatalogEntry[0].CatalogEntryId;
                        nodeRelation.CatalogNodeId = node.CatalogNodeId;
                        nodeRelation.SortOrder = 0;
                        if (nodeRelation.RowState == DataRowState.Detached)

                    if (relation.HasChanges())

Apr 18, 2013 11:57



Try this simple iteration. Maybe not the best practice but I think it would solve your situation.


ICatalogSystem system = CatalogContext.Current;                     // Get catalog lists                     CatalogDto catalogs = system.GetCatalogDto();                     foreach (CatalogDto.CatalogRow catalog in catalogs.Catalog)                     {                         string catalogName = catalog.Name;                         // Get Catalog Nodes                         CatalogNodeDto nodes = system.GetCatalogNodesDto(catalogName);                         foreach (CatalogNodeDto.CatalogNodeRow node in nodes.CatalogNode)                         {                             Console.WriteLine(node.Name + " Category Node");                             CatalogSearchParameters pars = new CatalogSearchParameters();                             CatalogSearchOptions options = new CatalogSearchOptions();                             options.CacheResults = false;                             options.RecordsToRetrieve = 8000;                             pars.CatalogNames.Add(catalogName);                                                        Mediachase.Commerce.Catalog.Objects.Entries entries = CatalogContext.Current.FindItems(pars, options, new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.CatalogEntryInfo));

                            if (entries.Entry != null)                             {                                 foreach (Entry entryDelete in entries.Entry)                                 {                                     CatalogContext.Current.DeleteCatalogEntry(entryDelete.CatalogEntryId, true);                                     Console.WriteLine(entryDelete.Name + " IS DELETED");                                 }                             }

                        }                     }                     Console.WriteLine("DONE DELETE");

Apr 23, 2013 9:41

Thank you

Apr 23, 2013 10:22

Hi Palle,

I know that this thread is pretty old, but I stumbled on only this thread from entire internet with the same problem you mentioned here. Could you please help me or tell me the solution you found for deleting the entries with all the relations?

Thanks for your help! 




Dec 18, 2013 22:59


You can use ICatalogSystem with two methods:

- DeleteCatalogEntry(int entryId, bool recursive) to delete a CatalogEntry.

- DeleteCatalogNode(int catalogNodeId, int catalogId) to delete a CatalogNode

Please note that in Commerce 7.5, two new methods were added to make the delete easier:

DeleteCatalogNodeAndEntries(int catalogNodeId);

DeleteCatalogNodesAndEntries(IEnumerable<int> catalogNodeIds);

Hope this helps.




Dec 19, 2013 4:42

Thanks Quan for your help. These APIs are deleting the CatalogEntry completly .. no matter how many relations they have. I want only the mentioned relation to be delted. 

For ex; Coca cola (UPC=XYZ) is at two place 1. Products > Soda and 2. Products > Grocery > Soda

I want to just delete 2nd one and keep the first relation as it is. Please help. Thanks again for your help.

Dec 20, 2013 21:14


You can do this by delete the relevant row in NodeEntryRelation table. Pseudo code:

            var entry = CatalogContext.Current.GetCatalogEntryDto(123);
            var row = entry.NodeEntryRelation.Rows.Cast<Mediachase.Commerce.Catalog.Dto.CatalogEntryDto.NodeEntryRelationRow>().First(c => c.CatalogNodeId == 123);

Hope this helps.


Dec 23, 2013 2:58

Perfect! Thx Quan.

Dec 23, 2013 22:48
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.