Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not find Category by code if category is empty #134

Open
OlegoO opened this issue Mar 20, 2018 · 1 comment
Open

Could not find Category by code if category is empty #134

OlegoO opened this issue Mar 20, 2018 · 1 comment

Comments

@OlegoO
Copy link
Contributor

OlegoO commented Mar 20, 2018

We could not find category id by code if category is empty

Expected behavior

Find category by code if category is empty

Actual behavior

Categories is empty.
I see result if I add any product into category.

Steps to reproduce

 private readonly ICatalogSearchService _searchService;

            var searchCreteria = new SearchCriteria
            {
                ResponseGroup = SearchResponseGroup.WithCategories,
                Code = categoryCode,
                CatalogId = catalogId,
                Take = 1,
                Skip = 0,
                SearchInChildren = true
            };
            var result = _searchService.Search(searchCreteria);
            result.Categories.FirstOrDefault();

@OlegoO OlegoO added this to the Operations milestone Mar 20, 2018
@OlegoO OlegoO changed the title We don Could not find Category by code Mar 20, 2018
@OlegoO OlegoO changed the title Could not find Category by code Could not find Category by code if category is epmty Mar 20, 2018
@OlegoO OlegoO changed the title Could not find Category by code if category is epmty Could not find Category by code if category is empty Mar 20, 2018
@OlegoO
Copy link
Contributor Author

OlegoO commented Mar 21, 2018

I used workaround

private readonly Func<ICatalogRepository> _catalogRepositoryFactory;

using (var catalogRepository = _catalogRepositoryFactory())
            {
                return catalogRepository.Categories.Where(c => c.CatalogId == catalogId && c.Code == categoryCode).Select(c => c.Id).FirstOrDefault();
            }

@OlegoO OlegoO closed this as completed Mar 21, 2018
@OlegoO OlegoO reopened this Mar 22, 2018
@t13ka t13ka removed this from the Operations milestone Dec 25, 2019
@tatarincev tatarincev removed their assignment Dec 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants