London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Get all strongly typed SKU's

Vote:
 

Hi,

What is the best way to get all the strongly typed sku's from a given catalog? I cant use the index.

#123010
Jun 22, 2015 22:39
Vote:
 

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.

Regards.

/Q

#123013
Jun 23, 2015 8:37
Vote:
 

Hi,

You mean by using the contentrepository.getdescendents and then the contentrepository.getitems?

#123015
Jun 23, 2015 8:59
Vote:
 

Hi,

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.

Regards.

/Q

#123022
Jun 23, 2015 9:37
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.