on 2025 Jan 28 1:52 PM
Hi,
I'm putting hands on some custom logic that uses the method de.hybris.platform.catalog.model.classification.ClassificationClassModel#getClassificationAttributes to retrieve the list of classificationAttributeModels assigned to a specific ClassificationClass (Classifying Categories tab in the backoffice), what is the right way to populate this collection? I see that the attribute is writable=false inside catalog-items.xml:
<attribute qualifier="classificationAttributes" type="ClassificationAttributeList">
<description>list of all attributes available within this class</description>
<modifiers read="true" write="false" search="false" optional="true"/>
<persistence type="jalo"/>
</attribute>
So I was wondering what was the right way to populate this the ClassificationAttributeList collection, the only way I could insert data is using forceWrite=true via impex. Has someone experienced this?
Thank you
Request clarification before answering.
The attribute classificationAttributes is defined with Jalo persistence, so how it is retrieved can be found in the Jalo class de.hybris.platform.catalog.jalo.classification.ClassificationClass.
In the Jalo class, the getClassificationAttributes() method calls getClassificationAttributeAssignments(), which adds ClassificationAttribute objects from ClassAttributeAssignments to a list and returns it. The getClassificationAttributeAssignments() method, in turn, calls getDeclaredClassificationAttributeAssignments() for the ClassificationClass and its supercategories of type ClassificationClass.
When you check the getDeclaredClassificationAttributeAssignments() method, you'll see the following FlexibleSearch query:
SELECT {PK} FROM FROM {ClassAttributeAssignment}
WHERE {classificationClass}= ?me
ORDER BY {position} ASC, {creationtime} ASC
Therefore, you should create ClassAttributeAssignment records for the ClassificationClass and ClassificationAttribute. After doing so, you should see classificationAttributes populated in Backoffice..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
16 | |
2 | |
2 | |
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.