Connector for HCL Commerce Manual / Version 2010
Table Of Contents
Each lc:include
tag requests an HTML fragment via HTTP from the CAE.
Every link within a fragment that is requested by the commerce system from the CAE is processed by the
LiveContextLinkTransformer
class. The transformer only applies for
fragment requests and finally requests URL templates from the LinkRepository
on the Commerce Adapter side.
For fragment request the Commerce Adapter returns JSON strings to the CAE.
Each of these JSON objects contains at least the values of the constants objectType
and
renderType
and the ID of the content or commerce object.
Assume the HTML fragment contains a link to a CMArticle
document. Instead
of rendering the regular link, for example
http://cae-host/blueprint/servlet/page/mySite/mySegment/mySeoContent-4712
the corresponding Link generated by the LiveContextLinkResolver
would
look like:
a href="<!--CM { "id":"cm-1696-4712", "renderType":"url", "externalSeoSegment":"mySeoContent-4712", "objectType":"content"} CM-->" ...
The CoreMedia Fragment Connector
on the commerce side parses the JSON, identifies the object
type and rendering type and applies a template to render a commerce link. For the given example,
the template Content.url.jsp
is used, applied by the pattern
"<OBJECT_TYPE>.<RENDER_TYPE>.jsp".
The JSP file on the commerce side finally generates the resulting URL.
http://localhost/webapp/wcs/stores/servlet/CoreMediaContentURL? storeId=10202&externalSeoSegment=spring-salads-1888& urlRequestType=Base&langId=-1&catalogId=10051
Example 7.6. Commerce URL
Note
The SEO feature has not been configured for this example, otherwise the
externalSeoSegment
value would be used to render a SEO friendly URL.
Other templates are located in the folder
workspace\Stores\WebContent\Widgets-CoreMedia\com.coremedia.commerce.store.widgets.CoreMediaContentWidget\impl\templates
by default. The path is configurable via property
com.coremedia.widget.templates
in
coremedia-connector.properties
. New templates can be added by extending the
CommerceLinkResolver
in the Blueprint workspace. Custom object types
can be added, depending on the document type of the content or its property values. Also,
additional rendering types can be defined for an object type. Using this templating mechanism,
it is possible to support different layouts for content depending on its context.