Casting TreeNode as SKUTreeNode

Keith Donnell asked on August 27, 2015 17:22

I have a product node (type CMS.Product) in my site, and I am trying to get an instance of a SKUTreeNode referencing the existing node. According to the example at, I should be able to cast a TreeNode as a SKUTreeNode, but that is not the case.

Here is my code:

var existingProductNode = tree.SelectSingleNode(new NodeSelectionParameters() { ClassNames = productPageType.ClassName, AliasPath = null, Where = "NodeName = '" +"'", "''") + "'" });
SKUTreeNode productDoc = (SKUTreeNode)existingProductNode;

The second line fails with the exception "Unable to cast object of type 'CMS.DocumentEngine.TreeNode' to type 'CMS.Ecommerce.SKUTreeNode'"

How can I get the SKUTreeNode instance?

Recent Answers

Roman Hutnyk answered on August 27, 2015 23:51

Try SKUTreeNode sku = SKUTreeNode.New(...);

0 votesVote for this answer Mark as a Correct answer

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