K Khan
Apr 11, 2013
(0 votes)

Get the PageData of some Catalog Node

Below function can help you to retrieve PageData object of some CatalogNode without effecting performance.

        private PageData FindPageByCatalogNode(CatalogNode catalogNode)
            string text = (catalogNode.ParentNode != null) ? catalogNode.ParentNode.ID :
            if (text == null)
                CatalogDto catalogDto = CatalogContext.Current.GetCatalogDto(catalogNode.CatalogId);
                text = ((catalogDto == null || catalogDto.Catalog == null || catalogDto.Catalog.Count == 0)
                ? string.Empty : catalogDto.Catalog[0].Name);
            string key = MappedPPDB.BuildKey(new object[]
            int id = MappedPPDB.Instance.LoadMapping("CatalogPageProvider", key).Id;
            return DataFactory.Instance.GetPage(new PageReference(id, "CatalogPageProvider"));

Apr 11, 2013


Please login to comment.
Latest blogs
Preview multiple Visitor Groups directly while browsing your Optimizely site

Visitor groups are great - it's an easy way to add personalization towards market segments to your site. But it does come with it's own set of...

Allan Thraen | Sep 26, 2022 | Syndicated blog

The Report Center is finally back in Optimizely CMS 12

With Episerver.CMS.UI 12.12.0 the Report Center is finally re-introduced in the core product.

Tomas Hensrud Gulla | Sep 26, 2022 | Syndicated blog

Dynamic Route in ASP.NET Core When MapDynamicControllerRoute Does Not Work

Background Creating one of the add-on for Optimizely I had to deal with challenge to register dynamically route for the API controller. Dynamic rou...

valdis | Sep 25, 2022 | Syndicated blog

404 Error on Static Assets Within an Optimizely plugin

Background With the move to CMS 12 and .NET 5/6, developers are now able to build Plugins and Extensions using Razor Class Libraries (RCL).  These...

Mark Stott | Sep 23, 2022