Skip to Content

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

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>
 
 

Add comment
10|10000 characters needed characters exceeded

3 Answers

  • Best Answer
    Posted on Oct 23, 2018 at 08:31 PM

    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");
    
    
    
    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 23, 2018 at 07:33 AM

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

    The renderer ignores any additional configuration.

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 23, 2018 at 06:54 PM

    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

    Add comment
    10|10000 characters needed characters exceeded