We have a multi lingual site (English and Arabic). We are using FindPagesWithCriteria to return a filtered list of pages. The original code,
PropertyCriteriaCollection criterias = DataFactory.Instance.FindPagesWithCriteria(this.ListingRootPage, criterias, AccessLevel.NoAccess)
returned all the correct results for english, however, does not seam to return results for arabic.
I thought this might be a language issue, especially as there where pages that didn't have arabic content. I tried to modify it to this:
PropertyCriteriaCollection criterias = DataFactory.Instance.FindPagesWithCriteria(this.ListingRootPage, criterias,lang.LanguageID, LanguageSelector.Fallback(lang.LanguageID, false), AccessLevel.NoAccess)
This code returns no results for english or arabic.
Any ideas as to why this is causing an issue? I cannot see why this would not work?
Ok, Found a work around.
Couldn't get FindPagesWithCriteriato work specifying the language Id, so instead I added the PageLanguageID as a criteria.
PropertyCriteria criteria = new PropertyCriteria();criteria.Name = "PageLanguageID";criteria.Condition = EPiServer.Filters.CompareCondition.Equal;criteria.Type = PropertyDataType.String;criteria.Value = this.CurrentPage.LanguageID;criteria.Required = true;criterias.Add(criteria);
This seams to work fine.