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.