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

Hi!
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)
.ToList();

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.

2 Likes

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