Take the community feedback survey now.

K Khan
Apr 11, 2013
  4322
(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
Turbocharge your strings - a case of display channels

When doing a routine performance test, during a CMS 12 upgrade, I was able to achieve 95% performance improvement. Let's look at SearchValues with ...

Stefan Holm Olsen | Sep 14, 2025 |

Opal Core Concepts

Before you dive into the code, it's crucial to understand the foundational ideas that make Opal tick. Core concepts are consistent across all its...

K Khan | Sep 13, 2025

Optimizely Opal : Reimagining A Utility Sector Use Case

  Introduction Customer engagement through timely and personalized push notifications plays a crucial role in todays Digital First landscape. In th...

Ratish | Sep 12, 2025 |

A day in the life of an Optimizely OMVP - AEO & GEO: The Future of Digital Visibility with Optimizely

The way people discover content online is undergoing a seismic shift. Traditional SEO is no longer enough. With AI-powered tools like ChatGPT,...

Graham Carr | Sep 12, 2025