Extend ‘ProductList.Details.View’ and sortOptions and set value and name in sort option
sortOptions: _.extend(ProductListDetailsView.prototype.sortOptions,
[
{
value: ‘category’,
name: Utils.translate(‘Sort by category’)
},
]}
Extend ‘ProductList.Item.Search’ search function and add the below code in that function.
if (sort_column === ‘category’) {
sort_column = ‘sort’;
}
}
Also update searchHelper function
searchHelper: function (filters, sort_column, sort_direction, include_store_item) {
// Selects the columns
var productListItemColumns = {
sort: new nlobjSearchColumn('custrecord_thr_sort'),
};
Add the sort option in productListItemColumns.
‘custrecord_thr_sort’ is a custom field in productlist and based on the value in this custom field sorting will take place.