nopSolutions / nopCommerce

ASP.NET Core eCommerce software. nopCommerce is a free and open-source shopping cart.
https://www.nopcommerce.com
Other
9.14k stars 5.25k forks source link

Subcategory products ignore category display order when displayed in the parent category #7146

Closed exileDev closed 4 months ago

exileDev commented 4 months ago

nopCommerce version: 4.60.2 (and later versions)

Expected behaviour:

Products sorted by Category.DisplayOrder then ProductCategory.DisplayOrder (this caters for products associated to multiple categories, where the order might be different in each one)

Actual behaviour: Products sorted by ProductCategory.DisplayOrder from first/random category

Steps to reproduce the problem:

Set catalogsettings.showproductsfromsubcategories to true

Create a parent Category ID, Name 1, Parent

Create 2 child categories ID, Name, DisplayOrder 2, ChildA, 100 3, ChildB, 99

Create two products ID, Name 1, ProductA 2, ProductB

Associate products to the categories CategoryID, ProductID, DisplayOrder 2,1,1 2,2,1 3,1,2 3,2,1

The products should be ordered by the Category.DisplayOrder then the ProductCategory.DisplayOrder, instead they are ordered by the DisplayOrder of the first ProductCategory (which in practice is similar to sorting by CategoryID then the Products DisplayOrder in the first category it is in)

Source: https://www.nopcommerce.com/en/boards/topic/98936/searchproductsasync-ordering-ignores-category-order-in-default-sort

exileDev commented 4 months ago

Closed #7146