Need to add a new sort option in the wishlist
for that first need to add options using extending the product detail view in entry point
_.extend(ProductListDetailsView.prototype, {
sortOptions: _.extend(ProductListDetailsView.prototype.sortOptions,
[
{
value: 'subcategory',
name: Utils.translate('Sort by sub category')
}
]
),
On the script side get option add our customised formula for sorting the same
_.extend(ProductListItemSearch, {
search: function (user, product_list_id, include_store_item, sort_and_paging_data) {
var sort_column = sort_and_paging_data.sort;
var sort_direction = sort_and_paging_data.order;
if (sort_column === 'subcategory') {
sort_column = 'brand';
}
brand: new nlobjSearchColumn("formulatext").setFormula(" {custrecord1} ||' ' || TRIM(REGEXP_SUBSTR({custrecord_product_category}, '[^:]+*$'))")