Get Parent Category Id by category name

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
I am creating a plugin and trying to Get  Parent category Id by category name

I have an Idea to use  product Category Repository and write linq query like below:      

var query = from pc in _productCategoryRepository.Table


But is there a service to this ?
7 years ago
stom wrote:
I am creating a plugin and trying to Get  Parent category Id by category name

I have an Idea to use  product Category Repository and write linq query like below:      

var query = from pc in _productCategoryRepository.Table


But is there a service to this ?


No, you have to write your own method for this ==>

you may go through ==>Libraries\Nop.Services\Catalog\CategoryService.cs
7 years ago
stom wrote:
I am creating a plugin and trying to Get  Parent category Id by category name

I have an Idea to use  product Category Repository and write linq query like below:      

var query = from pc in _productCategoryRepository.Table


But is there a service to this ?


I think you should need use categoryId instead use categoryName, and you can to use GetCategoryById method in Category service of Nop.Services.Catalog library. It will help your site increase performance in query.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.