Skip to Content
0
Jun 08, 2018 at 08:39 AM

Multivalue productfeature get other values

339 Views

Hi, the sample docs have this code to get a feature value https://help.hybris.com/6.7.0/hcd/8b7a777486691014823afa6e0ed7bb61.html

 ProductModel product;
 
 final FeatureList featureList = classificationService.getFeatures(product);
 final Feature feature = featureList.getFeatureByCode("SampleClassification/1.0/graphics.resolutions");
 
 // get first value from the list
 final FeatureValue value = feature.getValue();
 
 // change the value
 value.setValue("2048x1280");
 
 // store list
 classificationService.setFeatures(product, featureList);

In the case it's a multivalue attribute on the product like Resolution: 800 x 600 Resoluion: 1024 x 768 Resolution: 2048 x 1024

The above code will always get the first value (800 x 600). When the product might have numerous values with that same code (SampleClassification/1.0/graphics.resolutions)

Is there a way to get the second row, or any other row by PK ? For example i want to get the 2048 x 1024 value to update.