Developer forum

Forum » Ecommerce - Standard features » Get available sort options from index

Get available sort options from index

Martin Grønbekk Moen
Reply

Hi!

Is it possible to get all available sorting options from the index http://screencast.com/t/H5Z6ihegqRik ?

I would love to have a loop the list all sorting options dynamically in the frontend instead of coding them manually.

/Martin
 


Replies

 
Nicolai Høeg Pedersen
Reply

Hi Martin

I think this should do it:

//Given the index 'Products' in 'Ecommerce' repository: \Files\System\Repositories\Ecommerce\Products.index
IIndexService indexingService = ServiceLocator.Current.GetInstance<IIndexService>();
IIndex index = indexingService.LoadIndex("Ecommerce", "Products.index");
foreach (Schemas.FieldDefinitionBase f in index.Schema.Fields) {
}

 

You must be logged in to post in the forum