change the sort order to Lowest price as default.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
10 年 前
How to change the sort order to Lowest price as default.

Can anyone help me to make lowest to highest price the default sort by selection
10 年 前
To change the sort order by default you should modify display order of items from

Nop.Core\Domain\Catalog\ProductSortingEnum.cs as here

        /// <summary>
        /// Price: Low to High
        /// </summary>
        PriceAsc = 0,
10 年 前
Thank you.

What about already published solution how can I change there.
10 年 前
MateenK wrote:
Thank you.

What about already published solution how can I change there.


You can do this only by editing the source code. You will have to re-publish the solution.
10 年 前
hi..
it's changing the position..but not querying...it's defaulty displying position only..
9 年 前
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
9 年 前
I ran this query on my database and it worked perfectly. Thanks lestrois!
8 年 前
I found there are a few threads re: this

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.