Try our conversational search powered by Generative AI!

Product search sorting (Commerce 1.0 SP1)

Vote:
 

Hi

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?

#54719
Oct 31, 2011 6:35
Vote:
 

Hi,

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

#54818
Nov 04, 2011 4:39
Vote:
 

Hi and thanks for the response.

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

#54872
Nov 08, 2011 7:13
Vote:
 

Hi,

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.

/DL

#54875
Edited, Nov 08, 2011 8:05
Vote:
 

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

 

#54882
Nov 08, 2011 10:22
Vote:
 

Hi,

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

/DL

#54883
Nov 08, 2011 10:25
Vote:
 

Hi

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.

#54884
Nov 08, 2011 11:19
Vote:
 

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 ?

#63711
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.