This class represents a page designer managed page. A page comprises of multiple regions that hold components, which themselves again can have regions holding components, i.e. spanning a hierarchical tree of components.
Using
a page can be rendered. As such page implements a render function for creating render output the render function of the page itself will also want to access its various properties like the SEO title etc.Apart from rendering to markup a page can also be serialized, i.e. transformed into a json string using
true
if the page is currently visible which is the case if:
- page is published
- the page is set to visible in the current locale
- all visibility rules apply, requiring that
- schedule matches
- customer group matches
- aspect attribute qualifiers match
- campaign and promotion qualifiers match
false
will be returned.
As visibility is driven by the merchant configured dynamic visibility rules, e.g. scheduling and custom segmentation, this
call should NOT happen in a pagecached context outside of the processing induced by rendering/serialization (see the corresponding
methods in PageMgr).
Use hasVisibilityRules() prior to calling this method in order to check for the existence of visibility rules. If there are
visibility rules then do not apply pagecaching. Otherwise the visibility decision making would end up in the pagecache and any subsequent
call would just return from the pagecache instead of performing the isVisible() check again as desired.
...
var page = PageMgr.getPage(pageID);
if(page.hasVisibilityRules())
{
// pagecaching is NOT ok here
if(page.isVisible())
{
response.writer.print(PageMgr.renderPage(pageID, {});
}
}
else
{
// pagecaching is ok here, but requires a pagecache refresh if merchants start adding visibility rules to the page
}
...
Returns the raw attribute value identified by the specified attribute id.
true
if the page has visibility rules (scheduling, customer groups, aspect attribute qualifiers, campaign and promotion qualifiers) applied, otherwise false
.true
if the page is currently visible which is the case if: - page is published
- the page is set to visible in the current locale
- all visibility rules apply, requiring that
- schedule matches
- customer group matches
- aspect attribute qualifiers match
- campaign and promotion qualifiers match
false
will be returned.Returns the raw attribute value identified by the specified attribute id. By raw attribute value we denote the unprocessed value as provided for the attribute driven by the type of the respective attribute definition:
boolean
-> booleancategory
-> string representing a catalog category IDcustom
-> Map that originates from a stringified curly brackets {} JSON objectcms_record
-> Map that originates from a stringified curly brackets {} JSON object whose entries must adhere to thecmsrecord.json
schemaenum
-> either string or integerfile
-> string representing a file path within a libraryimage
-> Map that originates from a stringified curly brackets {} JSON object whose entries must adhere to thecontent/schema/image.json
schemainteger
-> integermarkup
-> string representing HTML markuppage
-> string representing a page IDproduct
-> string representing a product SKUstring
-> stringtext
-> stringurl
-> string representing a URL
There is two places an attribute value can come from - either it was persisted at design time (e.g.
by the merchant by editing a component in Page Designer) or it was injected in shape of an aspect attribute at rendering time
through the execution of code. The persistent value, if existing, takes precedence over the injected aspect
attribute one. Injection of a value through an aspect attribute will only occur if the page attribute's
attribute definition was declared using the "dynamic_lookup"
property and its aspect attribute alias matches
the ID of the respective aspect attribute.
Accessing the raw value can be helpful if render and serialization logic of the page needs to operate on these unprocessed values. An unprocessed value might be fundamentally different from its processed counterpart, the latter being provided through the content dictionary (see PageScriptContext.getContent()) when the render/serialize function of the page is invoked.
null
otherwise.
true
if the page has visibility rules (scheduling, customer groups, aspect attribute qualifiers,
campaign and promotion qualifiers) applied, otherwise false
. Use this
method prior to isVisible(), so you do not call the latter in a pagecached context.true
if the page has visibility rules applied, otherwise false
.
true
if the page is currently visible which is the case if:
- page is published
- the page is set to visible in the current locale
- all visibility rules apply, requiring that
- schedule matches
- customer group matches
- aspect attribute qualifiers match
- campaign and promotion qualifiers match
false
will be returned.
As visibility is driven by the merchant configured dynamic visibility rules, e.g. scheduling and custom segmentation, this
call should NOT happen in a pagecached context outside of the processing induced by rendering/serialization (see the corresponding
methods in PageMgr).
Use hasVisibilityRules() prior to calling this method in order to check for the existence of visibility rules. If there are
visibility rules then do not apply pagecaching. Otherwise the visibility decision making would end up in the pagecache and any subsequent
call would just return from the pagecache instead of performing the isVisible() check again as desired.
...
var page = PageMgr.getPage(pageID);
if(page.hasVisibilityRules())
{
// pagecaching is NOT ok here
if(page.isVisible())
{
response.writer.print(PageMgr.renderPage(pageID, {});
}
}
else
{
// pagecaching is ok here, but requires a pagecache refresh if merchants start adding visibility rules to the page
}
...
true
if the page is currently visible (published, visible in the current locale, and visibility rules apply), otherwise false
(unpublished and/or visibility rules don't apply)