Try our conversational search powered by Generative AI!

Geting product from Variation(SKU)

var catalogEntryResponse = new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.CatalogEntryFull);
var catalogEntries = CatalogContext.Current.GetCatalogEntries(new[] { 555555 }, catalogEntryResponse);

    this is how im geting variation(SKU), there are fields: Entry and ParentEntry, both are always null, nomatter what i change in CatalogEntryResponseGroup.


So if i have Variation what are the ways to get product?

May 21, 2012 14:18

actually entry is filled for product and from product i can get variation but not vice versa

May 21, 2012 15:38


helped me resolve this

May 23, 2012 10:51

In R2SP2 you can use 

CatalogRelationDto relation = CatalogContext.Current.GetCatalogRelationDto(childId);
if (relation != null && relation.CatalogEntryRelation != null)

    int parentid = relation.CatalogEntryRelation[0].ParentEntryId


May 24, 2012 21:54

in my opinion this will be faster compared to your solution of getting parentId and then geting entry for parent id, cos there is one request to db and db does the joining:

public static Entry GetParent(this Entry entry, CatalogEntryResponseGroup.ResponseGroup responseGroup)
            var searchOptions = new CatalogSearchOptions {CacheResults = true};

            var searchParams =
                new CatalogSearchParameters
                        JoinType = "Inner Join",
                        JoinSourceTable = "CatalogEntry",
                        JoinTargetQuery =
                            "(Select ParentEntryId, ChildEntryId, RelationTypeId From CatalogEntryRelation) CatalogEntryRelation",
                        JoinSourceTableKey = "CatalogEntryId",
                        JoinTargetTableKey = "CatalogEntryRelation.ParentEntryId",
                        SqlWhereClause = "CatalogEntryRelation.ChildEntryId=" + entry.CatalogEntryId +
                                         " And CatalogEntryRelation.RelationTypeId=N'" + EntryRelationType.ProductVariation + "'"

            var catalogEntryResponseGroup = new CatalogEntryResponseGroup(responseGroup);

            var result = CatalogContext.Current.FindItems(searchParams, searchOptions, catalogEntryResponseGroup);

            if (result.Entry == null || !result.Entry.Any())
                return null;

            return result.Entry.First();

    am i wrong, why?

Edited, May 25, 2012 9:49

I have not tested which one would be faster but they would be both be making two database calls as FindItems first gets a group of catalog entry ids and stores those ids in catalogsearchreults with a search set guid.  Another call is made to populate the catalogentrydto bases on the ids stored with the catalogsearchresults.

Also just showing there was a new overload to get parententryids for a child entry id as it has been a requested method.  Although you will still need to check the RelationType as it brings back all EntryRelationTypes


May 25, 2012 23:23
Oct 22, 2013 14:07
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.