Followed this tutorial http://world.episerver.com/documentation/commerce/get-started-with-commerce/3--creating-a-start-page/ to get going with episerver commerce. It works fine when writing the url to a specific problem.
But say that I have the following tree.
Catalog Root -> testcatalog -> testlevel -> testproduct 1 and 2
When on testevel (Has the model MyNode if looking at the tutorial), how do I get all child "products", testproduct 1 and 2? It seems like there are 100 ways of doing this.
Using latest episerver and episerver commerce (9).
Found a way of doing it.
var contentRepository = ServiceLocator.Current.GetInstance<IContentRepository>();
var products = contentRepository.GetChildren<MyProduct>(Model.ContentLink);
foreach(var product in products)
{
//Do what you want.
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.