按照本教程http://world.episerver.com/documentation/commerce/get-started-with-commerce/3--creating-a-start-page/开始使用episerver商务。当把url写到一个特定的问题时,它工作得很好。
但是假设我有下面的树。
目录根->测试目录->测试级->测试产品1和2
在testevel上(如果查看教程,模型是否为MyNode ),如何获得所有子"products",即TestProduct1和2?似乎有100种方法可以做到这一点。
使用最新的episerver和episerver商业(9)。
发布于 2016-04-07 13:30:50
找到了一种方法。
var contentRepository = ServiceLocator.Current.GetInstance<IContentRepository>();
var products = contentRepository.GetChildren<MyProduct>(Model.ContentLink);
foreach(var product in products)
{
//Do what you want.
}https://stackoverflow.com/questions/36455793
复制相似问题