What is the best way to get all the strongly typed sku's from a given catalog? I cant use the index.
The strong typed catalog content types are per-system, not per catalog, so there're two ways to do this:
- Iterate over all variation contents in your catalog. This is the most accurate way, but should be very slow - avoid if you have a big catalog.
- Use reflection to get all types inherited from VariationContent. As I mentioned above, this might not be entirely accurate if you have content types which do not belong to the catalog - but should be much faster.
You mean by using the contentrepository.getdescendents and then the contentrepository.getitems?
Basically yes, you'll need to be recursively.
- Use IContentRepository.GetChildren<NodeContent> to get all the nodes
- For each node, use IContentRepository.GetChildren<VariationContent> to get the variations.
One much faster way but will involve sql script:
- Query CatalogEntry table to get the distinct metaclass Ids of SKUs (ClassTypeId = "Variation" , (remember to filter CatalogId = specific catalog id)
- use reflection to get all all types inherited from VariationContent, then get the content types which have MetaClassId that belong to previous list.