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 https://docs.kentico.com/display/K82/Importing+products+using+API, 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 = '" + itemGroup.name.Replace("'", "''") + "'" }); 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?
Try SKUTreeNode sku = SKUTreeNode.New(...);
SKUTreeNode sku = SKUTreeNode.New(...);
Please, sign in to be able to submit a new answer.