Hello, i have a question about getting the cultured homenode in umbraco 8 in the controller.
I have a homenode with different languages, example /it,/es, /sv.
And i want to get the root node of these. and when im getting it with my code i only get the english version.
anyone have any clue ?
here is my code
private List<IPublishedContent> GetProductsToFilter()
{
var home = Umbraco.ContentAtRoot().First();
if (home == null)
return null;
var homeChildren = home.Children;
var mainProductsPage = homeChildren?.Where(p => p.ContentType.Alias == "products").FirstOrDefault();
if (mainProductsPage == null)
return null;
List<IPublishedContent> umbracoProducts = new List<IPublishedContent>();
foreach (var products in mainProductsPage.Children)
{
// 1. We take 'products' with
// 2. children of type 'filter'
// 3. where is only one 'filter' child
var productFilter = products.Children;
if (productFilter == null)
continue;
if (productFilter.Count() == 1 &&
productFilter.FirstOrDefault().ContentType.Alias.Equals("filterOption") &&
products.ContentType.Alias.Equals("products"))
umbracoProducts.Add(products);
}
return umbracoProducts;
}
Cultured root node in controller
Hello, i have a question about getting the cultured homenode in umbraco 8 in the controller.
I have a homenode with different languages, example /it,/es, /sv. And i want to get the root node of these. and when im getting it with my code i only get the english version.
anyone have any clue ? here is my code
Kind regards/ Emil
I guess what you can change Thread culture?
Hi Emil
Try this code for getting home node:
How did you make a multicultural solution with Umbraco 8?
Thanks, Alex
is working on a reply...