Quantcast
Channel: Customized Commerce 13 and earlier versions
Viewing all articles
Browse latest Browse all 9642

Get ALL commerce catalogs

$
0
0

Can anyone tell me how to retrieve all catalogs out of commerce?  I'm not sure if I am missing something simple or if this is a bug. I am creating a scheduled task where I need to loop through our catalogs and perform some tasks on them.  I thought the following line of code would work, but discovered that one of our catalogs is not coming back in the results.  

var catalogs = _contentLoader.GetChildren<CatalogContent>(_referenceConverter.GetRootLink());

We have catalog A with languages of en-us, en-ca, and fr-ca.

We have catalog B with language of en-us

We have catalog C with languages of en-ca and fr-ca <note that this is the only catalog that does not have en-us as an available language>

When I call the code above, I only get catalog A and B back.  So finally, I went to catalog C and added en-us as an available language to see if I got it back in the call.  When I run the code, I in fact will get it back in the results.  I then removed en-us as an available language for C and made the call again, and C is not in the results. 

Worst case scenario, I loop through the ILanguageBranchRepository.ListEnabled() and add each distinct catalog I find to my own list to loop through, but that just seems dumb that I would have to go down that path.

Thoughts?


Viewing all articles
Browse latest Browse all 9642

Trending Articles