Try our conversational search powered by Generative AI!

K Khan
Apr 11, 2013
  3906
(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 Web... 6 Game Changing Features in 2024

If you are interested in learning about what's new within Optimizely Web, you are in the right place. Carry on reading to learn about the 6 greates...

Jon Jones | Mar 3, 2024 | Syndicated blog

Headless forms reloaded (beta)

Forms is used on the vast majority of CMS installations. But using Forms in a headless setup is a bit of pain since the rendering pipeline is based...

MartinOttosen | Mar 1, 2024

Uploading blobs to Optimizely DXP via PowerShell

We had a client moving from an On-Prem v11 Optimizely instance to DXP v12 and we had a lot of blobs (over 40 GB) needing uploading to DXP as a part...

Nick Hamlin | Mar 1, 2024 | Syndicated blog

DbLocalizationProvider v8.0 Released

I’m pleased to announce that Localization Provider v8.0 is finally out.

valdis | Feb 28, 2024 | Syndicated blog