cancel
Showing results for 
Search instead for 
Did you mean: 

Display relational attribute in Backoffice list view

former_member196079
Active Contributor
0 Kudos
714

Hi experts

i've created an extension of Product with a custom one, then i've extended that with a relational attribute with a relation one to many.

here the itemType (related) creation

<itemtype code="ColorazioneTabList" extends="GenericItem" autocreate="true" generate="true" jaloclass="it.xx.xxpcm.jalo.ColorazioneTabList">
	<description>Colorazione</description>
	<deployment table="ColorazioneTabList" typecode="20300"/>
	<attributes>
         <attribute qualifier="" type="colorazioneEnum">
			<description>Colorazione</description>
			<modifiers initial="true"/>
			<persistence type="property" />
         </attribute>
		<attribute qualifier="colore" type="coloreEnum">
			<description>Colore</description>
			<modifiers initial="true"/>
			<persistence type="property" />
		</attribute>
	</attributes>
</itemtype>

then i've assigned the itemType to the main item with relation one to many:

<relation code="ColorazioneXXProductRel" autocreate="true" generate="true" localized="false">
	<sourceElement qualifier="colorazione" type="ColorazioneTabList" cardinality="many" collectiontype="list">
		<modifiers read="true" write="true" search="true" optional="true"/>
	</sourceElement>
	<targetElement qualifier="custProduct" type="custProduct" cardinality="one">
		<modifiers read="true" write="true" search="true" optional="true" />
	</targetElement>
</relation>

i've also modified backoffice-config.xml to show this new attribute in backoffice:

<context merge-by="type" parent="GenericItem" type="Product" component="editor-area">
	<ea:editorArea name="xxMaster">
		<ea:tab name="xx.tab.product.master" position="10">
			<ea:section name="xx.tab.product.master.colore">f
				<ea:attribute qualifier="colorazione"/>
			</ea:section>			
		</ea:tab>
	</ea:editorArea>
</context>

The result is this:

now my question is:

Is possible to display some colorazioneTabList details(Colorazione, color) in the list, instead of the string "ColorazioneTabList[8796093607327]" ?

I would like to display something like this:(approvers in b2bUnit)

can anybody help me?

Best regards

Marco

Accepted Solutions (1)

Accepted Solutions (1)

Hi Marco,

If I've got you correctly you should do something like this.

<context type="ColorazioneTabList" component="base">    <y:base xmlns:y="http://www.hybris.com/cockpit/config/hybris">        <y:labels>            <y:label>                @labelService.getShortObjectLabel(colorazione) + ' - ' + @labelService.getObjectLabel(colore) </y:label>        </y:labels>    </y:base></context>

In case that this doesn't work for you, you need to use a custom renderer using spring-bean for the attribute you want to display.

Something like this below.

<editorArea:tab name="hmc.tab.product.extendedattributes" merge-mode="append" position="4"><br>    <editorArea:customSection name="colore" spring-bean="coloreCustomSectionRenderer"/><br></editorArea:tab>

Hope this helps.

Best Regards,

former_member196079
Active Contributor
0 Kudos

Hi Svetlin

Thanks for your hint.

I've tried adding the snippet suggested but the restult is this:



<context type="ColorazioneTabList" component="base">
   <y:base xmlns:y="http://www.hybris.com/cockpit/config/hybris">
      <y:labels>
         <y:label>@labelService.getShortObjectLabel(colorazione) + ' - ' + @labelService.getObjectLabel(colore) + '</y:label>
      </y:labels>
   </y:base>
</context>

and i'm having this server error:
Expression [@labelService.getShortObjectLabel(colorazione) + ' - ' + @labelService.getObjectLabel(colore) + '] @96: EL1046E: Cannot find terminating ' for string

am i doing something wrong?

Thanks

Marco

Hi Marco,

I've found a typo in the provided example.

<contexttype="ColorazioneTabList" component="base"><y:base xmlns:y="http://www.hybris.com/cockpit/config/hybris"><y:labels><y:label>@labelService.getShortObjectLabel(colorazione)+' - '+@labelService.getObjectLabel(colore) </y:label></y:labels></y:base></context>
<br>

Try to to remove " + ' " before </y:label> tag.

Best Regards,

former_member196079
Active Contributor

Hi Svetlin

Thanks!it works!

Best regards

Marco

0 Kudos

Hi Marco,

Good to know. Can you please vote for the provided solution.

Best Regards,

Answers (1)

Answers (1)

former_member196079
Active Contributor
0 Kudos

anyone can help me?