Programmatically creating new Catalog Section pages



We're running into a problem where rolling out changes to a Catalog Blueprint isn't propagating new section pages when they are created programmatically using the PageManager API.

Take a Catalog Blueprint that was created programmatically and is located at:

Creating a Catalog in Sites from this blueprint in Touch UI using Create > Catalog works fine and the catalog including all section and product pages are created as expected.

If you create a new section page either through Touch UI:

or even in Classic UI

and then do a "Rollout Changes" at master_catalog level from within TouchUI the new pages are rolled out as expected. Great so far.

However, when a new section page is created programmatically using the PageManager API that page is not rolled out when the same "Rollout Changes" is initiated.

Comparing the nodes and node properties across the three different section pages that were created (TouchUI, ClassicUI and PageManager API) the only difference in the properties of the programmatic one is that the protected properties "jcr:created" and "jcr:createdBy" are not present on the "jcr:content" node.

It sounds feasible that a new page wouldn't be picked up if those properties weren't there but of course that's pure theory.

Here's the code used to create the new section page.

PageManager pageManager = resourceResolver.adaptTo(PageManager.class);

Page newPage = pageManager.create("/content/catalogs/gtsp/products/es/master_catalog", "programmatic", "/libs/commerce/templates/section", "programmatic", true);

// Have to set these as the jcr:content node gets created by PageManager as "nt:unstructured" with no template or resource type

Node newPageNode = newPage.adaptTo(Node.class);

Node cont = newPageNode.getNode("jcr:content");


cont.setProperty("cq:template", "/libs/commerce/templates/section");

cont.setProperty("sling:resourceType", "commerce/components/section");

Any ideas?





When you say "However, when a new section page is created programmatically using the PageManager API that page is not rolled out when the same "Rollout Changes" is initiated." I'm assuming you mean a page in your blueprint?

When I look at pages in a catalog, the jcr:content node has a filter and target node as subnodes, perhaps you need those as well?




Thanks for your quick reply, yes it does have those. However the page that get's created using Classic UI doesn't have them and still gets rolled out.

If I go ahead and create another catalog after adding the new section page, it will build the new section page. It's purely when rolling out changes to an existing catalog that a new page doesn't get rolled out. I can see in the sectionRolloutHook() it processing the existing section pages but the hook isn't being triggered for the new section page.