Comments (2)
Hello,
this code works for us:
`var PageMgr = require('dw/experience/PageMgr');
var CatalogMgr = require('dw/catalog/CatalogMgr');
/**
-
Serialized one or more page designer pages into JSON
*/
function serialize() {
// construct JSON Array by hand, as PD streams on response which we need to do as well.
response.writer.print('[');
if (request.httpParameterMap.pageIds.submitted) {
var pageIds = request.httpParameterMap.pageIds.stringValue.split(',');
pageIds.forEach((pageId, index, all) => {
response.writer.print(PageMgr.serializePage(pageId, null));
if (index !== all.length - 1) {
response.writer.print(',');
}
});
}if (request.httpParameterMap.aspect.submitted && request.httpParameterMap.category.submitted) {
var category = CatalogMgr.getCategory(request.httpParameterMap.category.stringValue);
var page = PageMgr.getPage(category, true, request.httpParameterMap.aspect.stringValue);
if (page) {
response.writer.print(PageMgr.serializePage(page.ID, null));
}
}response.addHttpHeader('Content-Type', 'application/json');
response.writer.print(']');
}
serialize.public = true;
exports.Serialize = serialize;`
And you can call it: PageDesigner-Serialize?pageIds=homepage-example
from pwa-kit.
OH MAN!
We used the method you provided and finally got the PageDesigner json data;
Thank you very much;
from pwa-kit.
Related Issues (20)
- [QUESTION] About optional outputDir HOT 3
- [FEATURE] Normalize `request.ip` and `request.ips` on MRT
- [FEATURE] Add an "echo" endpoint to the default app that responds with the details of the request HOT 2
- [BUG] Cannot read properties of undefined (reading 'unshift') HOT 2
- [FEATURE] Use Cache Control directive `stale-while-revalidate` in default caching headers HOT 1
- [BUG] withReactQuery not getting dependent querys HOT 2
- [BUG] Jest tests throw invalid parameter warning HOT 2
- [BUG] - operation not permitted HOT 1
- [BUG] Support Non-ASCII characters in HTTP Request Header Values HOT 3
- [FEATURE] Add support for hi-res / medium images to image gallery HOT 2
- [BUG] v3.5 - Duplicate subpath in request to get oauth token HOT 1
- [FEATURE] Add Sitemap handling HOT 2
- [FEATURE] Shopper Context Integration
- [BUG]Out of stock products should also be considered as unavailable products and be removed from cart and checkout page HOT 1
- [BUG] Seo component not setting keywords meta tag HOT 3
- [BUG] Cannot use import statement outside a module HOT 10
- [BUG] Missing onContextChange callback for version 2.8 HOT 1
- [FEATURE] Allow multiple MRT environments to share a single domain
- [FEATURE] Support Maintenance Mode 🚧 HOT 1
- [BUG] Custom parameters not taking into account for cache invalidation HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pwa-kit.