How can I change the sorting by orders in the admin panel?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 years ago
How can I change the sorting by orders in the admin panel by the value of the attribute of the product’s property?
4 years ago
Specify the order parameter of ProductServce.SearchPtoduct method in ProductModelFactory as below code.

var products = _productService.SearchProducts(showHidden: true,
                categoryIds: categoryIds,
                manufacturerId: searchModel.SearchManufacturerId,
                storeId: searchModel.SearchStoreId,
                vendorId: searchModel.SearchVendorId,
                warehouseId: searchModel.SearchWarehouseId,
                productType: searchModel.SearchProductTypeId > 0 ? (ProductType?)searchModel.SearchProductTypeId : null,
                keywords: searchModel.SearchProductName,
                pageIndex: searchModel.Page - 1, pageSize: searchModel.PageSize,
                overridePublished: overridePublished
                orderBy: //your sorting value);


To be noted, sorting options are fixed. If you want to sort by any other property than those, then you have to add extra enum property in ProductSortingEnum and modify stored procedure ProductLoadAllPaged.
4 years ago
mhsjaber wrote:
Specify the order parameter of ProductServce.SearchPtoduct method in ProductModelFactory as below code.

var products = _productService.SearchProducts(showHidden: true,
                categoryIds: categoryIds,
                manufacturerId: searchModel.SearchManufacturerId,
                storeId: searchModel.SearchStoreId,
                vendorId: searchModel.SearchVendorId,
                warehouseId: searchModel.SearchWarehouseId,
                productType: searchModel.SearchProductTypeId > 0 ? (ProductType?)searchModel.SearchProductTypeId : null,
                keywords: searchModel.SearchProductName,
                pageIndex: searchModel.Page - 1, pageSize: searchModel.PageSize,
                overridePublished: overridePublished
                orderBy: //your sorting value);


To be noted, sorting options are fixed. If you want to sort by any other property than those, then you have to add extra enum property in ProductSortingEnum and modify stored procedure ProductLoadAllPaged.



I need to change the method public virtual ActionResult OrderList(DataSourceRequest command, OrderListModel model), what would be ranking by product property in the order, date criterion
4 years ago
I have a product order that has a date property, I need to select all orders for this property in the admin panel in the list of all orders
4 years ago
You need to modify the Model, Controller, and View to support the additional search criteria, and then also modify the ProductService.SearchProducts() and modify stored procedure ProductLoadAllPaged.

Alternately, you could create a new 'Report'.
4 years ago
be careful from doing changement directly to the standard code, the best approach is to create plugins for any changement, otherwise, you may face a big problems during migrations especially that the nopcommerce code is changing so much since the version 4.0
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.