on 2020 Nov 18 11:50 AM
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
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,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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,
Hi Svetlin
Thanks!it works!
Best regards
Marco
anyone can help me?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.