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

Sorting behaviour in hybris 6.7 backoffice menus (i.e. attributes)

arthurjs2
Participant
0 Likes
1,187

Hello,

Is there a way to define a default sorting within submenus of Hybris Backoffice?

Inside the Attributes tab of a product, I have several menus of ClassificationClasses which I have provided with a 'position' via impex,

but the order of these menus is seemingly random. The position attribute does not seem to influence the order, it is not alphabetical or reverse, and the ClassificationClass codes are out of order (i.e. 10 20 70 40 30).

Can I define/influence how these submenus are displayed?

Accepted Solutions (1)

Accepted Solutions (1)

mpern
Product and Topic Expert
Product and Topic Expert
0 Likes

The "Attributes" tab in the backoffice is a special case, as it defines a completely custom renderer for the whole thing ( spring-bean="classificationTabEditorAreaRenderer")

And, it looks like the custom renderer doesn't respect the position, which for me means this is a bug.

If you need this solved now, you either have to override the custom renderer, or tweak how the features are loaded from the DB. the classificationTabEditorAreaRenderer uses DefaultClassificationService#getFeatures(ProductModel) to load the data.

I would try overriding the DefaultClassificationService with a custom implementation, that sorts the features by their position, this should influence the order in the backoffice too

arthurjs2
Participant
0 Likes

Great, thanks for looking into how to fix it. It does seem like a bug.

Thank you!

Answers (1)

Answers (1)

former_member638920
Discoverer
0 Likes

Actually, this is not a bug and it's the expected behaviour since by default those classification attributes are ordered in backoffice alphabetically.

This is done via the assureAlphabeticalAttributeOrder method of the ClassificationTabEditorAreaRenderer class using its FeatureComparator.

You can find the ClassificationTabEditorAreaRenderer bean definition in hybris/bin/ext-platform-backoffice/platformbackoffice/resources/platformbackoffice-backoffice-spring.xml file:

 <alias name="defaultClassificationTabEditorAreaRenderer" alias="classificationTabEditorAreaRenderer"/>
 <bean id="defaultClassificationTabEditorAreaRenderer"
 class="de.hybris.platform.platformbackoffice.classification.ClassificationTabEditorAreaRenderer"
 parent="abstractEditorAreaComponentRenderer">
 ....
 <property name="featureComparator">
 <bean class="de.hybris.platform.platformbackoffice.classification.comparator.FeatureComparator"/>
 </property>
 ...
 </bean>
 </property>
 </bean>


To implement your custom order you can override the ClassificationTabEditorAreaRenderer bean and provide your custom comparator which will be based on position.