cancel
Showing results for 
Search instead for 
Did you mean: 

How to get classification attributes specific to a product from classification class

Former Member
0 Kudos

I am able to go till classificationData . However the Feature Data is null though there are attributes defined.

final CatalogVersionModel catalogVersionModel = catalogVersionService.getCatalogVersion(catalogId, catalogVersionId);

final ProductGroupDTO productGroupDTO = productGroupDataFacade.retrieveProductGroup(catalogVersionModel, productGroupCode);

     model.addAttribute("productGroupData", productGroupDTO);
     final QIAProductGroupModel qiaproduct = (QIAProductGroupModel) productService.getProductForCode(catalogVersionModel,
             productGroupDTO.getCode());
     final ProductModel pmodel = productService.getProductForCode(catalogVersionModel, productGroupDTO.getCode());
     
     
     final ProductModel product = qiaproduct;
     

     
     final ClassificationSystemVersionModel versions = classificationService.getSystemVersion(myclassificationsystem, version);

 
     final List<SpecificationData> specificationdata = new ArrayList<SpecificationData>(); 


     final List<ProductOption> options = new ArrayList<>(Arrays.asList(ProductOption.BASIC, ProductOption.PRICE,
             ProductOption.SUMMARY, ProductOption.DESCRIPTION, ProductOption.GALLERY, ProductOption.CATEGORIES,
             ProductOption.REVIEW, ProductOption.PROMOTIONS, ProductOption.CLASSIFICATION, ProductOption.VARIANT_FULL,
             ProductOption.STOCK, ProductOption.VOLUME_PRICES, ProductOption.PRICE_RANGE));
     final ProductModel productModel = productService.getProductForCode(productGroupDTO.getCode());
     final ProductData productData = productFacade.getProductForOptions(productModel, options);
     for (final ClassificationData classificationData : productData.getClassifications())
     {
         if (classificationData != null)
         {
             for (final FeatureData featureData : classificationData.getFeatures())
             {

                 if (featureData != null)
                 {
                     LOG.info("featureData" + classificationData.getFeatures().size() + featureData.getName());
                     final int i = 0;
                     specificationdata.get(i).setSpecname(featureData.getName());
                     for (final FeatureValueData featureValueData : featureData.getFeatureValues())
                     {
                         if (featureValueData != null)
                         {
                             LOG.info("featureData" + featureData.getFeatureValues());
                             final List<String> specvalue = new ArrayList<String>();
                             specvalue.add(featureValueData.getValue());
                             specificationdata.get(i).setSpecvalue(specvalue);

                         }
                     }
                 }
             }
         }
     }

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Aditi,

I dont see anything wrong in your code so I assume that problem is with the data. Could you please check how you defined your Feature Values. I assume that you haven't set values for Label properties for your Feature Value. You can check this in hmc: go to Catalog->Classification Systems ->Feature Values -> choose your feature value

If you haven't set Label properties for your feature value, please do that and run your code again.

If this solution doesn't work could you, please, provide me more information about this product (I need all attributes that this product gained through the classification system).

Hope this helps :)