November Happy Hour will be moved to Thursday December 5th.

K Khan
Apr 11, 2013
  4010
(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 :
            CatalogContext.Current.GetCatalogNode(catalogNode.ParentNodeId).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[]
            {
                catalogNode.CatalogNodeId,
                string.Empty,
                catalogNode.ParentNodeId,
                catalogNode.CatalogId,
                NodeType.CatalogNode,
                catalogNode.ID,
                text
            });
            int id = MappedPPDB.Instance.LoadMapping("CatalogPageProvider", key).Id;
            return DataFactory.Instance.GetPage(new PageReference(id, "CatalogPageProvider"));
        }

Apr 11, 2013

Comments

Please login to comment.
Latest blogs
Optimizely SaaS CMS + Coveo Search Page

Short on time but need a listing feature with filters, pagination, and sorting? Create a fully functional Coveo-powered search page driven by data...

Damian Smutek | Nov 21, 2024 | Syndicated blog

Optimizely SaaS CMS DAM Picker (Interim)

Simplify your Optimizely SaaS CMS workflow with the Interim DAM Picker Chrome extension. Seamlessly integrate your DAM system, streamlining asset...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Optimizely CMS Roadmap

Explore Optimizely CMS's latest roadmap, packed with developer-focused updates. From SaaS speed to Visual Builder enhancements, developer tooling...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Set Default Culture in Optimizely CMS 12

Take control over culture-specific operations like date and time formatting.

Tomas Hensrud Gulla | Nov 15, 2024 | Syndicated blog