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

How to get main category name from super categories

former_member634320
Participant

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Likes

HI ,

Use below OOTB service and you will get the all the super categories ordered by level wise. and you can get what level category you want.

 final Collection<List<CategoryModel>> categoryPaths = this.categoryService.getPathsForCategory(parentCategoryForProduct);
 
             if (CollectionUtils.isNotEmpty(categoryPaths)) {
                 final List<CategoryModel> pathForParentCategory = categoryPaths.iterator().next();
                 if (null != pathForParentCategory && pathForParentCategory.size() > 3) {
 
                     if (this.getCategoryLevel() == 1 && pathForParentCategory.get(1).getIsIndexable() != null


If my answer really help full to me .please accept my answer.