Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

A little help when upgrading from 11 to 13 (obsolete and removed object types and methods)

$
0
0

I have tried to search for a guide and setup on how to replace our current logic when updating. So my last resort is to post on the forums here in hopes that you guys can guide me a bit.

We currently have some code in our inRiver Import Controller that is obsolete and removed. I would like to get some help to find the way to achieve something similar in Epi Commerce 13.

1st snippet: (Mediachase.Commerce.Catalog.Objects.Entry)

Entry entry = CatalogContext.Current.GetCatalogEntry(catalogEntryId);
                if (entry == null)
                {
                    Log.Warning($"Could not find catalog entry with id: {catalogEntryId}. No entry is deleted");
                    return false;
                }
                entryId = entry.CatalogEntryId;
                metaClassId = entry.MetaClassId;
                catalogId = entry.CatalogId;

2nd snippet: (Mediachase.Commerce.Catalog.Objects.CatalogNode)

Here we need cn.CatalogNodeId and cn.CatalogId

                CatalogNode cn = CatalogContext.Current.GetCatalogNode(catalogNodeId);
                if (cn == null || cn.CatalogNodeId == 0)
                {
                    Log.Warning($"Could not find catalog node with id: {catalogNodeId}. No node is deleted");
                    return false;
                }
                catalogId = cn.CatalogId;
                nodeId = cn.CatalogNodeId;

variation of 2nd Snipper:

foreach (CatalogRelationDto.NodeEntryRelationRow row in rel.NodeEntryRelation)
                    {
                        CatalogNode catalogNode = CatalogContext.Current.GetCatalogNode(row.CatalogNodeId);
                        if (updateEntryRelationData.RemoveFromChannelNodes.Contains(catalogNode.ID))
                        {
                            Log.Debug($"Removing relation to Node with id {catalogNode.CatalogNodeId} and code {catalogNode.ID}");
                            row.Delete();
                        }
                    }

3rd snippet: (Mediachase.Commerce.Catalog.Objects.Entry)

Here we want the "childEntry.ID".

                        foreach (CatalogRelationDto.CatalogEntryRelationRow row in rel3.CatalogEntryRelation)
                        {
                            Entry childEntry = CatalogContext.Current.GetCatalogEntry(row.ChildEntryId);
                            if (childEntry.ID == updateEntryRelationData.CatalogEntryIdString)
                            {
                                Log.Debug(
                                    $"Relations between entries {row.ParentEntryId} and {row.ChildEntryId} has been removed, saving new catalog releations");
                                row.Delete();
                                CatalogContext.Current.SaveCatalogRelationDto(rel3);
                                break;
                            }
                        }

Viewing all articles
Browse latest Browse all 9076

Trending Articles