Try our conversational search powered by Generative AI!

Product search sorting (Commerce 1.0 SP1)



we are using the SearchFilterHelper to execute the search and the criteria uses CatalogEntrySearchCriteria.DefaultSortOrder (the constants value is _sortorder) which to my understanding should sort the results according to the sort oder that is in the product (Commerce Manager UI sort order field). But if I change the sort order for a product it doesn’t have any effect on the order the results are returned (and I have rebuilt the index) and when looking at the returned properties of a product there is no sort order field.

So shoud it be possible to sort the products according to the sort order visible in the Commerce Manager UI or should this be implemented by us for example by creating a new metafield ProductDisplaySortOrder and use that to order the products?

Oct 31, 2011 6:35


You can try to parse CatalogEntryResponseGroup.ResponseGroup.CatalogEntryFull to SearchFilterHelper.SearchEntries method. This will return full information of catalog entry

Hope this helps.

/Dzung Le

Nov 04, 2011 4:39

Hi and thanks for the response.

We are already using the CatalogEntryFull so it is not about that.

Nov 08, 2011 7:13


I think you can create new SortObject with sort field name as SortOrder instead of using the DefaultSortOrder

SearchSort sortObject = new SearchSort("SortOrder");

And because SortOrder is the meta field, then you cannot access it as a property of product.  The meta fields can be accessed through the Entry class API using the ItemAttributes member

Entry entry = CatalogContext.Current.GetCatalogEntry("YourEntryCode", new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.CatalogEntryFull));
var sortOrder = entry.ItemAttributes["SortOrder"].Value;



Hope this helps.


Edited, Nov 08, 2011 8:05

Thanks again for the reply.

To me it really looks like that the sort order that is avaiulable in the UI is not actually used or returned in the code. We had already checked the returned properties from the entry.ItemAttributes collection and there we can only see the following properties:

  • Attribute
  • CreatedBy
  • CreatedDate
  • Files
  • Image
  • Images
  • ListPrice
  • MaxQuantity
  • MinQuantity
  • ModifiedBy
  • ModifiedDate
  • Weight


Nov 08, 2011 10:22


I think in this case you can creat your own meta field and call like "CustomSortOrder", then you can search, sort by your meta field (remember to check "Allow Search" for your meta field).

In your meta class, select your custom meta field and then you can update value for product. I believe that the search result will contain custom meta field when you attach it to meta class


Nov 08, 2011 10:25


thanks for trying to help, so my original thought was correct.

Maybe you guys could update the Commerce documentation and samples about it unless this is a bug.

Nov 08, 2011 11:19

I am trying to sort the Product list on Enoteca site but I am unable to find out where and what value I should pass so that the Product list resultant will sorted by "High to Low" and "Low to High price". Can you please give me an idea how can I make it working ?

Nov 27, 2012 13:26
* 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.