on 2019 Apr 22 7:42 PM
Hello Experts,
I have a task to populate product features with new value and remove the existing feature value. I have used below code :
final FeatureList features = getClassificationService().getFeatures(product);
Feature productfeature = features.getFeatures().get(0);
productfeature.removeAllValues();
productfeature.setValues(my_fvalues);
getClassificationService().setFeature(product, productfeature);
But still I can see old value in product feature values. I believe that's because old value still exist in product feature model.
I am not getting how to remove the old feature before persisting new .
Any help is appreciated !
regards, Sid
Request clarification before answering.
Hi All,
I achieved through:
final FeatureList featureList = classificationService.getFeatures(product);
for (final Feature productFeature : featureList.getFeatures())
{
if (productFeature.getClassAttributeAssignment().getClassificationClass().getCatalogVersion().getCatalog().getId()
.equalsIgnoreCase(customClassification))
{
productFeature.removeAllValues();
}
}
classificationService.replaceFeatures(product, featureList);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 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.