I'm trying to integrate Sitecore E-Commerce Services (SES) into an existing site with existing products (available as Sitecore items).
When I try to retrieve the products like this:
IProductRepository productRepository = Sitecore.Ecommerce.Context.Entity.Resolve<IProductRepository>();
var builder = new CatalogQueryBuilder();
var productTemplateId = "{C7B33629-A35B-4EF8-8FE7-9343ACAA6FBE}";
var productTemplate = new ListString { productTemplateId };
var query = builder.BuildQuery(new SearchOptions { Templates = productTemplate });
var products = productRepository.Get<ProductBaseData, Query>(query);
The products variable is empty and no exceptions are thrown.
Any ideas what I might be missing?
Info about templates & config
The product items use a custom template which derives from the ProductBaseData template. The product repository item derives from the Repository template.
The following is added to the Unity config:
<alias alias="MyProduct" type="MyNamespace.MyProject.Product, MyNamespace.MyProject" />
<register type="ProductBaseData" mapTo="MyProduct" name="{C7B33629-A35B-4EF8-8FE7-9343ACAA6FBE}"/>
In addition the Lucene index has been configured to point to the product repository and I can see (using Luke) that the products are being indexed.