Friday 31 August 2018

BackOffice Customization in Hybris

* Create new Tab, attributes, Tree node in BackOffice.

1. Create trainingbackoffice extension.
2. Create a new tab and add attributes to the tab for Customer.
3. Create a new Tree node and add to advanced search fields and simple search.

Step 1:- Create trainingbackoffice extension.

* Goto platform directory and run  ant extgen.
* select ‘ybackoffice’ template.
* Give name and package and saas .
* New folder created in the custom folder.
* Import to eclipse.

Step 2:-Create new tab and add attributes to the tab for Customer.


* Open trainingbackoffice-backoffice-config.xml and add this code

<config xmlns="http://www.hybris.com/cockpit/config"
xmlns:editorArea="http://www.hybris.com/cockpitng/component/editorArea"
xmlns:list-view="http://www.hybris.com/cockpitng/component/listView"
xmlns:advanced-search="http://www.hybris.com/cockpitng/config/advancedsearch"
xmlns:df="http://www.hybris.com/cockpitng/component/dynamicForms"
xmlns:dsb="http://www.hybris.com/cockpitng/config/dashboard"
xmlns:explorer-tree="http://www.hybris.com/cockpitng/config/explorertree"
xmlns:grid-view="http://www.hybris.com/cockpitng/component/gridView"
xmlns:na="http://www.hybris.com/cockpitng/config/notifications"
xmlns:simple-search="http://www.hybris.com/cockpitng/config/simplesearch"
xmlns:wz="http://www.hybris.com/cockpitng/config/wizard-config"
xmlns:y="http://www.hybris.com/cockpit/config/hybris">

<context merge-by="type"  type="Customer" component="editor-area">
<editorArea:editorArea>
<editorArea:tab name="hmc.tab.customer.custom"
position="1">
<editorArea:section name="hmc.section.customer.attributes">
<editorArea:attribute qualifier="dob" />
<editorArea:attribute qualifier="age" />
</editorArea:section>
</editorArea:tab>
 </editorArea:editorArea>
</context>
</config>

* Open trainingcore-locales_en.properies file and add this


type.Customer.dob.name=Date Of Birth
type.Customer.age.name=AGE

* Open labels_en.properties in trainingbackoffice extension and add this

hmc.tab.customer.custom =CUSTOM

hmc.section.customer.attributes=ATTRIBUTES

* Do ant build and update system by selecting running system & localization

* Or go to backoffice F4 and reset everything







Step 3:- Create new Tree node and add to advanced search fields and simple search.


* Open trainingbackoffice-backoffice-config.xml and add this code

<config xmlns="http://www.hybris.com/cockpit/config"
xmlns:editorArea="http://www.hybris.com/cockpitng/component/editorArea"
xmlns:list-view="http://www.hybris.com/cockpitng/component/listView"
xmlns:advanced-search="http://www.hybris.com/cockpitng/config/advancedsearch"
xmlns:df="http://www.hybris.com/cockpitng/component/dynamicForms"
xmlns:dsb="http://www.hybris.com/cockpitng/config/dashboard"
xmlns:explorer-tree="http://www.hybris.com/cockpitng/config/explorertree"
xmlns:grid-view="http://www.hybris.com/cockpitng/component/gridView"
xmlns:na="http://www.hybris.com/cockpitng/config/notifications"
xmlns:simple-search="http://www.hybris.com/cockpitng/config/simplesearch"
xmlns:wz="http://www.hybris.com/cockpitng/config/wizard-config"
xmlns:y="http://www.hybris.com/cockpit/config/hybris">

<context component="explorer-tree" module="trainingbackoffice" merge-by="module">
<n:explorer-tree xmlns:n="http://www.hybris.com/cockpitng/config/explorertree">
<n:navigation-node id="Training_Product">
<n:type-node code="TrainingProduct" id="TrainingProduct"/>
</n:navigation-node>
</n:explorer-tree>
</context>
<context type="TrainingProduct" component="listview" merge-by="type" parent="GenericItem">
<list-view:list-view>
<list-view:column qualifier="code" />
<list-view:column qualifier="name" />
<list-view:column qualifier="description" />
</list-view:list-view>
</context>
 <context merge-by="type"  type="TrainingProduct" component="editor-area">
<editorArea:editorArea>
<editorArea:tab name="hmc.tab.customer.common"
position="1">
<editorArea:section name="hmc.tab.customer.common">
<editorArea:attribute qualifier="code" />
<editorArea:attribute qualifier="name" />
<editorArea:attribute qualifier="description" />
</editorArea:section>
</editorArea:tab>
 </editorArea:editorArea>
</context>
<context type="TrainingProduct" component="advanced-search"
merge-by="type" parent="GenericItem">
<advanced-search:advanced-search>
<advanced-search:field-list>
<advanced-search:field name="code" operator="equals" selected="true" />
<advanced-search:field name="name" operator="equals" selected="true" />
<advanced-search:field name="description" operator="equals" selected="true"/>
</advanced-search:field-list>
</advanced-search:advanced-search>
</context>
<context type="TrainingProduct" component="simple-search" merge-by="type" parent="GenericItem">
<simple-search:simple-search>
<simple-search:field name="code" />
</simple-search:simple-search>
</context>
</config>


* Add properties in trainingcore-locales_en.properties & labels_en.properties .

type.Product.code.name =CODE
type.Product.name.name =NAME
type.Product.description.name =DESCRIPTION


hmc.section.Product= PRODUCT

hmc.tab.customer.common =COMMON

* Do ant build and update by selecting localized type & running system.














2 comments:

  1. Hi!
    you can get an error :
    ERROR [hybrisHTTP36] [DefaultEditorAreaSectionRenderer] Property dob was not found for type Customer
    ERROR [hybrisHTTP36] [DefaultEditorAreaSectionRenderer] Property age was not found for type Customer

    thats because User type have no dob and age attributes

    ReplyDelete
  2. You need to add it into Customer in items.xml first

    ReplyDelete