Is it possible to get the index of products in productlist?

Just want to get the products from a list in the same order as displayed in BO.
Is this possible?

Right now were fetching it like this:
var productList = _productListService.Get(currentPageTypeDefinition.AlternativeProductList).Items
.SelectMany(x => x.ActiveVariantSystemIds)
.Select(variant => _productItemViewModelBuilder.Build(_variantService.Get(variant), currentPage.WebSite, _cartService.Currency, WebsiteSettings.Instance.ShowProductQuantityBoxInProductLists, WebsiteSettings.Instance.ShowBuyButtonInProductLists))
.Where(item => item != null)

Litium version: 6.3.7

You could try retrieving the product list, checking if it’s a StaticProductList, inspect if it’s property ProductsSortOrder has any values (it won’t if it’s never been sorted) and use that list to sort the original list.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.