Professional Documents
Culture Documents
Basically w.r.t yhbirs framework each and every jsp page is split into different sections.
Each section will have content slots and each content slot will have compenents inside them.
To find each components inside the each content slot we need to go through the following steps.
First,for any jsp page we need to find the pagetemplate for that.
First we need to identify the home page Jsp .With the help of Jsp find the template which is used for composing the
Jsp page.Search for the Jsp page name in the cms-content.impex
For example :
If the home page of a website is landingLayout2Page.jsp search for the same jsp name in the impex file to find
the actual template which is used to map that jsp page.
INSERT_UPDATE PageTemplate;
$contentCV[unique=true];uid[unique=true];name;frontendTemplateName;restrictedPageTypes(code);active[default
=true]
;;LandingPage2Template;Landing Page 2 Template;layout/landingLayout2Page;CategoryPage,ContentPage
Now the edited screen will be like the one shown below
** You can see all Available contents slots which is shown above.
In the same page if you scroll down you can find
So if you want to find, what is the actual component which is inside the content slot for example
Which is given above you, edit the site logo content slot to find the component which is inside that.
Edit in new window will show the below one
In here the image named “commerce accelerator” is the one shown which will be shown in the actual website. You
can find all the details such as given below
Real filename: logo-hybris.png
Mime Type: image/png
Identifier: /images/theme/logo-hybris.png
Now if you want to modify the image or any details related to the image you can edit like the one shown below
Once you edit the it will be like
** You can upload your own image and I believe you need to synchronise which is given at the top and I believe by
doing so, the new image will be reflected in the website after necessary restarts or procedures.
**In the same way you can able to find all the components inside each content slot
which is located inside a section.
Lets get an idea about the .vm file.Well, what is an .vm file ?
It’s kind of an Jsp page where it will be used in the cmscockpit.Use of cmscockpit will be explained later.
But in a nutshell .vm file acts as renderer for bringing the sections of the Jsp page[for example is
landingLayout2Page.jsp ] into the cmscockpit.
This is basically done with the help of importing the impex file into the system.
First we need understand what are the existing datas out box which we can make us of.
For an ecommerce application there are two impex files which we can makes use of their data’s.The file name is
cmc-content.impex
$contentCatalog=electronicsContentCatalog
$contentCV=catalogVersion(CatalogVersion.catalog(Catalog.id[default=$contentCatalog]),CatalogVersi
on.version[default=Online])[default=$contentCatalog:Online]
$contentCatalog It’s a reference variable which refers to “electronicsContentCatalog” in the above case.
$contentCV is an macro which is referring the catalogue version and the application should be always marked as
Online like the one give above default=$contentCatalog:Online
UPDATE
GenericItem[processor=de.hybris.platform.commerceservices.impex.impl.ConfigPropertyImportProcessor];pk[unique
=true]
$jarResourceCms=$config-jarResourceCmsValue
So the next step is to create a Page Template with the help of Impex.
Sample Impex snippet for adding a new Page Template in to the system.
INSERT_UPDATE PageTemplate;
$contentCV[unique=true];uid[unique=true];name;frontendTemplateName;restrictedPageTypes(code);active[default
=true]
;;SampleHomePageTemplate;SampleHomePage Template;layout/SampleHomePage;ContentPage
Here, the Page template that we are creating is “SampleHomePage Template” and the JSP page that you are
mapping is “SampleHomePage”
Now we have created the page template, next steps is to create Sections. Sample Impex snippet to create a section is
INSERT_UPDATE ContentSlotName;name[unique=true];template(uid,$contentCV)[unique=true]
[default='SampleHomePageTemplate'];validComponentTypes(code);compTypeGroup(code)
;SiteLogo;;;logo
;HeaderLinks;;;headerlinks
;SearchBox;;;searchbox
As you can see, we are creating three sections [site logo, header links, and search box] inside the page template.
We are mapping the Sections with the Page template in the first line [default='SampleHomePageTemplate'];
The above impex code are the generic details, which we can make use of them in our impex.
The macro’s whichever is mentioned above will be referring to the existing data’s in the system.
All we are going to do is to make use of these macros which will be referred in some part of the impex say while we are creating a
components or anything we can make us of them.
1.6 Creating components for inserting them into the content slots:
Next step is to create components to insert them into the contents lot.
For example I am going to create a component in each content slot which means each content slot will have one component inside
each section.
I am going to create a SimpleBannerComponent where, I will be mapping the banner component to the specific content slot.
The below snippet is to insert the component into the content slot
# Content Slots
INSERT_UPDATE ContentSlot;
$contentCV[unique=true];uid[unique=true];cmsComponents(&componentRef)
;;contentslot1;SiteLogoComponent1
;;contentslot2;SiteLogoComponent2
;;contentslot3;SiteLogoComponent3
As you can see we are mapping the each SiteLogoComponent1 with the each contents lot like
;;contentslot1;SiteLogoComponent1
** You have to place all these impex files in a notepad so you can import or copy paste into the system
which is given in the next step.
INSERT_UPDATE PageTemplate;
$contentCV[unique=true];uid[unique=true];name;frontendTemplateName;restrictedPageTypes(code);a
ctive[default=true]
;;SampleHomePageTemplate;SampleHomePage Template;layout/SampleHomePage;ContentPage
INSERT_UPDATE ContentSlotForTemplate;
$contentCV[unique=true];uid[unique=true];position[unique=true];pageTemplate(uid,$contentCV)
[unique=true][default='SampleHomePageTemplate'];contentSlot(uid,$contentCV)
[unique=true];allowOverwrite
;;Section1-LandingPage1;SiteLogo;;contentslot1;true
;;Section2-LandingPage1;HeaderLinks;;contentslot2;true
;;Section3-LandingPage1;SearchBox;;contentslot3;true
INSERT_UPDATE ContentPage;$contentCV[unique=true];uid[unique=true];name;masterTemplate(uid,
$contentCV);label;defaultPage[default='true'];approvalStatus(code)
[default='approved'];homepage[default='true']
;;SampleHomePage;SampleHomePage;SampleHomePageTemplate;SampleHomePage
$contentCatalog=electronicsContentCatalog
$contentCatalogName=Electronics Content Catalog
$contentCV=catalogVersion(CatalogVersion.catalog(Catalog.id[default=$contentCatalog]),CatalogVersi
on.version[default=Online])[default=$contentCatalog:Online]
$productCatalog=electronicsProductCatalog
$productCatalogName=Electronics Product Catalog
$productCV=catalogVersion(catalog(id[default=$productCatalog]),version[default='Online'])
[unique=true,default=$productCatalog:Online]
$picture=media(code, $contentCV);
$image=image(code, $contentCV);
$media=media(code, $contentCV);
$page=page(uid, $contentCV);
$contentPage=contentPage(uid, $contentCV);
$product=product(code, $productCV)
$category=category(code, $productCV)
$siteResource=jar:de.hybris.platform.electronicsstore.constants.ElectronicsstoreConstants&/electronic
sstore/import/sampledata/contentCatalogs/$contentCatalog
$productResource=jar:de.hybris.platform.electronicsstore.constants.ElectronicsstoreConstants&/electr
onicsstore/import/sampledata/productCatalogs/$productCatalog
$jarResourceCms=jar:de.hybris.platform.electronicsstore.constants.ElectronicsstoreConstants&/electro
nicsstore/import/sampledata/cockpits/cmscockpit
# Content Slots
INSERT_UPDATE ContentSlot;
$contentCV[unique=true];uid[unique=true];cmsComponents(&componentRef)
;;contentslot1;SiteLogoComponent1
;;contentslot2;SiteLogoComponent2
;;contentslot3;SiteLogoComponent3
There are two ways you can import the impex into the system :
2.Add all your impex related details in to the CMS-Content.impex file which is inside the path
resources\electronicsstore\import\coredata\contentCatalogs\electronicsContentCatalog\cms-content.impex
Make sure you the order of the impex code that you created in hierarchy level.
Creating Page Creating Page Template Creating Sections Creating contenctslots creating components inserting the
components into content slot Creating content slot templates
The reason being you may face an error while importing the impex into the system if the impex code is not in hierarchy level since
there will references to the super objects.
Goto http://localhost:9001/console/impex/import
Copy your connects and paste into the area as shown below.
Click the button Import Content.The system will automatically imports the data’s into its DB.
**NOTE :
If you adding the impex to cms file you need to put ant all and restart the server and updated the actual project where the CMS-
Content file is located in the HMC.In this case it will be electronics store.
Goto HMC http://localhost:9001/hmc/hybris platform update select electronic store in this case and update it.
As you know we have created May item here.Just to make sure whether all detail are imported into the system.
In HMC goto Page Templates and search for the same template given below.You can find the template that has been created
under the catalogue.
**In the same way you can verify the sections, content slots, pages and components.
Just create an JSP page that includes the sections that you just imported.
For the above impex, the JSP that we created will be like this
If you see the sections that I added in the impex is given here, so that all the components and the content slots will be rendering
during runtime.
Once the JSP page is created stop the server and do an ant all and restart the server and do necessary updates.
Once these steps are done
Goot http://localhost:9001/cmscockpit/index.zul Select the site name Search for samplehomepage that we created
The things that you need to note is highlighted in yellow in the above screen shot.
Now search
Double click the Sample home page.You can see the three content slots that we added.Click the lock symbol in each of the content
slot to see the components inside it.
** You have to enable the homepage option as shown below.Make sure to disable this option for the existing
homepage