check this sql to update the displayorder column by price. you don't need to do it manually in admin.
update pcm set pcm.displayorder = tmp.rank from [Product_Category_Mapping] pcm, ( select p.id, p.price, pc.categoryid, pc.displayorder, RANK() OVER (PARTITION BY pc.categoryid ORDER BY p.price ASC) AS Rank from [dbo].[Product] p, [dbo].[Product_Category_Mapping] pc where p.id = pc.productid and p.price <> 0 ) tmp where pcm.productid = tmp.id and pcm.categoryid = tmp.categoryid
this is the way I've done it for 3.4 (not sure about later code)
in Nop.Core/Domain/Catalog/ProductSortingEnum.cs
change Position = 0 to Position = 1
in Nop.Web/Controllers/CatalogController.cs line 436 (just before PrepareSortingOptions(model.PagingFilteringContext, command);)
add
if ((ProductSortingEnum)command.OrderBy == 0) { command.OrderBy = (int)ProductSortingEnum.PriceAsc; }
so basically if the OrderBy is 0 then it will choose the default, changing Position to 1 stop this from being the default - further work could easily allow a setting to be used - the drop down in the store works correctly with this.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.