cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Display Relational Attributes Field on BackOffice

0 Likes
1,569

Hello,

I'm new with SAP Commerce and i have this problem:

i have the following relation:

<relation code="Cooperative2PointOfService" autocreate="true" generate="true" localized="false">
    <sourceElement qualifier="cooperative" type="Cooperative" cardinality="one">
        <modifiers optional="false" initial="true"/>
    </sourceElement>
    <targetElement qualifier="pointOfService" type="PointOfService" cardinality="many">
        <modifiers partof="true"/>
    </targetElement>
</relation>

So in the backoffice-config.xml for the Cooperative's backoffice page i display the PointOfService list in this way:

<context merge-by="type" type="Cooperative" component="listview">
   <list-view:list-view xmlns:list-view="http://www.hybris.com/cockpitng/component/listView">
      <list-view:column qualifier="pointOfService"/>
   </list-view:list-view>
</context>
<context type="pointOfService" component="base">
   <y:base xmlns:y="http://www.hybris.com/cockpit/config/hybris">
      <y:labels>
         <y:label>pointOfService</y:label>
      </y:labels>
   </y:base>
</context>

The problem is that in this way i display the list of the pointOfServiceModel(pk) like following screenshot:

But i would like to display the attribute pointOfService.name.

I've already tried to wrtite "pointOfService.name" instead of "pointOfService" in both xml components but this does not work....

Anyone can tell me the rigth way to show pointOfService.name in the list view?

Thank you for help.

Accepted Solutions (1)

Accepted Solutions (1)

former_member632827
Participant
0 Likes

Hi Brunato,

Already label is available for PointOfService in basecommercebackoffice-backoffice-config.xml

    <context type="PointOfService" component="base" merge-by="type" parent="GenericItem">
        <y:base xmlns:y="http://www.hybris.com/cockpit/config/hybris">
            <y:labels>
                <y:label>name</y:label>
            </y:labels>
        </y:base>
    </context>

We have another option with cell renderer spring-bean configuration. You can check OOTB

AbstractMedia syncStatus attribute list view configuration.

<list-view:columnqualifier="syncStatus" spring-bean="syncStatusCellRenderer" label="syncstatus.column.label"/>

or

StandardCurrencyListViewRenderer

<list-view:columnqualifier="totalPrice"spring-bean="standardCurrencyListViewRenderer"/>

Thanks.

Answers (1)

Answers (1)

jseidl
Explorer
0 Likes

I had a similar problem (1:n relation between productchangelog and product) and solved it like this in our extensions' backoffice config xml:

<context merge-by="type" type="ProductChangeLog" component="base" parent="GenericItem">
<y:base xmlns:y="http://www.hybris.com/cockpit/config/hybris">
<y:labels>
<y:label>modifiedtime + ' - ' + @labelService.getObjectLabel(product)</y:label>
</y:labels>
</y:base>
</context>