How To Get a Catalogue in Episerver Commerce

If you need to get the root catalogue node in Episerver commerce, you can use the ReferenceConverter API to get a link to the catalogues defined in your project, as follow.

var referenceConverter = ServiceLocator.Current.GetInstance<ReferenceConverter>();
var repository = ServiceLocator.Current.GetInstance<IContentRepository>();
var catalogues= repository.GetChildren<CatalogContent>(referenceConverter.GetRootLink());

You can then filter the catalogue you want via the Name property, e.g.

var referenceConverter = ServiceLocator.Current.GetInstance<ReferenceConverter>();
var rootLink = referenceConverter.GetRootLink();
var repository = ServiceLocator.Current.GetInstance<IContentRepository>();
var catalogRef = repository .GetChildren<CatalogContent>(rootLink)
.FirstOrDefault(x => x.Name == "CatalogName");

Conclusion

Today’s guide was very short and simple. We’ve briefly covered the Episerver commerce Api calls you will need to get your product catalogue from Episerver.

Jon D Jones

Software Architect, Programmer and Technologist Jon Jones is founder and CEO of London-based tech firm Digital Prompt. He has been working in the field for nearly a decade, specializing in new technologies and technical solution research in the web business. A passionate blogger by heart , speaker & consultant from England.. always on the hunt for the next challenge

More Posts

2 replies

Trackbacks & Pingbacks

  1. […] I’ve talked about the IContentRepository before quite a lot and if you want to see some code examples of how it works, I suggest you have a look at these posts How To Load And Retrieve A Variant or Product From EpiServer Commerce and How To Get a Catalogue in EpiServer Commerce […]

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *