pls help me to sort out this issue

ramesh perera asked on July 23, 2015 14:40

i have sku Number and skuid. how can i get node id from the code

thanks Ramesh

Recent Answers

Zach Perry answered on July 23, 2015 17:25 (last edited on July 23, 2015 17:25)

var whereCondition = string.Format("NodeSKUID = {0}", skuid);

// Ignore linked nodes
whereCondition = SqlHelper.AddWhereCondition(whereCondition, "NodeLinkedNodeID is null");
var tree = new TreeProvider(MembershipContext.AuthenticatedUser);
var nodes = tree.SelectNodes(SiteContext.CurrentSiteName, string.Empty,LocalizationContext.PreferredCultureCode, false, null, whereCondition, orderBy, -1, true, 1);

That might help.

1 votesVote for this answer Mark as a Correct answer

Roman Hutnyk answered on July 24, 2015 23:25

If this is Kentico 8 I'd recommend to use Document Query:

var docs = DocumentHelper.GetDocuments().Where(d => d.HasSKU && d.NodeSKUID == 1);

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.