Try our conversational search powered by Generative AI!

Entry sortorder

Vote:
 

I have x number of products that all belong to the same category node. Each product has a different sortorder set (I can see the value in Commerce Manager UI).

According to this blog post, CatalogRelationDto is the way to go to get hold of the sort order value. I've tried differect versions of the GetCatalogRelationDto method, but each time the NodeEntryRelation has 0 rows. 

var catalogRelationDto = CatalogContext.Current.GetCatalogRelationDto(styleCatalogEntryId);

int sortOrder = catalogRelationDto.NodeEntryRelation[0].SortOrder;

    

There is no field or metadata field for SortOrder on the catalog entry. I can easily get hold of the catalog node that the entry belongs to, but no sortorder there either.

Any tips would be appreciated.

 

#82999
Mar 24, 2014 13:25
Vote:
 

Correct link to blog post is:
http://world.episerver.com/Blogs/The-Ensconced-Armamentarium/Dates/2012/6/Entry-SortOrder-Property-Where-Are-You/

#83010
Mar 24, 2014 14:47
Vote:
 

Hello,

I would like to suggest you use this overload instead:  GetCatalogRelationDto(catalogId, catalogNodeId, entryCodeId, String.Empty, new CatalogRelationResponseGroup(CatalogRelationResponseGroup.ResponseGroup.NodeEntry)); You can only set the entryCodeId and leave catalogId and catalogNodeid to 0.

This overload guarantees that you will get the NodeEntryRelation table (which the ResponseGroup.NodeEntry parameter). The GetCatalogRelationDto(int catalogEntryId) only return the CatalogEntryRelation table. That's why you did not get any NodeEntryRelation row. And yes, you're correct to get/set SortOrer through the NodeEntryRelation row.

Regards.

/Q

#83012
Mar 24, 2014 15:25
Vote:
 

Thumbs up! ;)

#83016
Mar 24, 2014 17:18
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.