Sorting and Filtering
Sorting and Filtering
When can Sorting and Filtering be Applied
Sorting
// Category listing with sorting
var request = new GetEntitiesByAttributeRequest("Category", categoryName);
//Set the sort order of the products in the category
request.ResultsOptions.SortBy = new List<EntitySortingParameter>{
new EntitySortingParameter("Price")
{ Order = SortOrders.Asc}, // Primary sorting: Sort on attribute Price, ascending order
new EntitySortingParameter(EntitySortingParameter.Types.Popularity)
{ Order = SortOrders.Desc} // Secondary sorting: Sort on popularity, descending order
};
var response = _loop54Client.GetEntitiesByAttribute(request);// Category listing with sorting
GetEntitiesByAttributeRequest request = new GetEntitiesByAttributeRequest("Category", categoryName);
//Set the sort order of the products in the category
request.resultsOptions.sortBy = new ArrayList<>();
request.resultsOptions.sortBy.add(new EntitySortingParameter("Price"){{ order = SortOrders.ASC; }}); // Primary sorting: Sort on attribute Price, ascending order
request.resultsOptions.sortBy.add(new EntitySortingParameter(EntitySortingParameter.Types.POPULARITY){{ order = SortOrders.DESC; }});// Secondary sorting: Sort on popularity, descending order
GetEntitiesByAttributeResponse response = loop54Client.getEntitiesByAttribute(request);Filters
Last updated
Was this helpful?

