ContentTypeQueryParameters - Linking works only with item ID

June 21, 2024 9:06 AM

I have widget where editor can select products to display. ContentItemSelectorComponent returns Guids of selected products. I need to get some data from product page so in query I need to retreive all product pages which have product from widget selected in field IEnumerable<Product> ProductContentItem. I would like use this code:

new ContentItemQueryBuilder()
.ForContentType(ProductPage.CONTENT_TYPE_NAME,
    config => config.Linking(nameof(ProductPage.ProductContentItem), widgetProducts).WithLinkedItems(2)

but I can not, because Linking expect list of IDs not GUIDs. Is in XByK any smart altenative or I shoud use two queries (1st to get product IDs and 2nd to get product pages)

Thanks

Environment

Answers

Yes, that's because the "reference" or link is from ID to ID in the database.

You can execute 2 queries - the first will retrieve the IDs and the 2nd will retrieve the linked items.

Take a look at how I do something similar in the Kentico Community Portal project.


To answer this question, you have to login first.