cancel
Showing results for 
Search instead for 
Did you mean: 

Backoffice - Is it possible to change the editor used for classification attributes values in product Model ?

former_member1320010
Participant
0 Kudos

I tried the below configuration but did not help

 <context type="Product" component="editor-area">
 <editorArea:editorArea xmlns:editorArea="http://www.hybris.com/cockpitng/component/editorArea">
 <editorArea:customTab name="hmc.tab.attribute" spring-bean="classificationTabEditorAreaRenderer"  merge-mode="replace">
     <editorArea:section name="hmc.section.product.untypedfeatures"  merge-mode="replace">
     <editorArea:attribute xmlns="http://www.hybris.com/cockpitng/component/editorArea" merge-mode="replace" qualifier="untypedFeatures" description="hmc.text.product.untypedfeatures" editor="com.hybris.cockpitng.editor.localized(com.hybris.cockpitng.editor.wysiwyg)"/>
     </editorArea:section>
     </editorArea:customTab>
 
 

Accepted Solutions (1)

Accepted Solutions (1)

former_member1320010
Participant
0 Kudos

got it working with below configurations , hope this is the correct way

mybackoffice-spring.xml

 `<!-- Editors -->
 <cng:map-extender bean="editorRegistry" property="defaultEditorMapping">
         <cng:put key-type="java.lang.String" value-type="java.lang.String">
             <entry key="^FeatureValue\((.*)\)$" value="com.hybris.cockpitng.editor.myfeaturevalue"/>
         </cng:put>
 </cng:map-extender>`

Created a new Custom Editor similar to the FeatureValueEditor

and set the default editor in the render(Component parent, EditorContext context, EditorListener listener) method

  subEditor.setDefaultEditor("com.hybris.cockpitng.editor.wysiwyg");


mpern
Employee
Employee
0 Kudos

What a simple and therefore great solution!

For future reference, it looks like there is one common editor that wraps all feature values Feature Value Editor, and by modifying that editor, you can change what actual editor is used to edit the value

geffchang
Active Contributor
0 Kudos

Nice tip. You should probably accept your own answer as the official Answer. :)

Answers (2)

Answers (2)

former_member682593
Participant
0 Kudos

It's partially true what wrote (not possible by configuration only), but actually you can override the classificationTabEditorAreaRenderer bean, and it's method createEditor(), which will allow to show a different editor.

The class ClassificationTabEditorAreaRenderer indeed ignores any configuration, but this could be also overridden, by overriding the render() method, and put the 'configuration' parameter inside the widget's model. Then in the createEditor method we can get this config and read the 'editor' attribute.

We might capture this as an improvement, but the steps above should be sufficient to replace the classification editor.

Thanks, Marcin

romitchhabra
Participant
0 Kudos

@marcin.sulski

I am trying to extend ClassificationTabEditorAreaRenderer in my custom extension but not able to do the same and getting compile time error. My custom extesion has dependency on platformbackoffice extension. Error :

 import de.hybris.platform.platformbackoffice.classification.ClassificationTabEditorAreaRenderer;
   [yjavac]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   [yjavac] The import de.hybris.platform.platformbackoffice.classification cannot be resolved 

I think it is because of the fact that ClassificationTabEditorAreaRenderer is in platformbackoffice_bof.jar which is inside resource/backoffice folder of platformbackoffice extension and not inside the lib folder and thus it can't be accesssed by other extensions even if they are depedent on platformbackoffice extension. Can you give some idea how to extend ClassificationTabEditorAreaRenderer. Do I need to copy the jar and put it in my custom extension?

romitchhabra
Participant
0 Kudos

My issue is resolved, the issue was that my custom class which was extending ClassificationTabEditoAreaRenderer was not in backoffice/src folder but in src folder of the extension created through ybackoffice template.

After moving it to backoffice/src, it works perfectly.

mpern
Employee
Employee
0 Kudos

No it isnt, as the complete tab is rendered by the classificationTabEditorAreaRenderer.

The renderer ignores any additional configuration.