Close

Search Order by Position

richhoward
7 years ago
#12646 Quote
Avatar
  • 5
Hey guys I have spent quite a bit of time working on this and stuck at the last point...

I am trying to get our products to show by position in search. I found that to show by position in the category pages that I needed to set the display order in the product to category table. From what I am reading to set the sort order for search it needs to be in the product to manufacturer table?

For example this search: https://accessories.lazydays.com/filterSearch?q=dryer there is a product 10th on the list that has a sort order in the product to category, product to manufacturer and also just in the regular product table of -9999 lower then any other product as my test and it should be #1 no matter where I search in the results or in the category page for dryers.

Do you guys see what I am doing wrong why this product wont show up #1 for the term dryer in this example?

Thanks for your help as always.
SDobrev
7 years ago
#12656 Quote
Avatar
  • Moderator
  • 283
Hi,

I answered to your ticket but I will also copy the answer here so the others can see it.

NopCommerce search engine takes into account the product to category mapping display order only if there is a "Category" specified from the Advanced search.

It is the same with the Manufacturer mapping display order. If there is manufacturer specified from the Advanced search than the products will be sorted by Display order after the search.

Here is the part of the stored procedure for the sorting:

--sorting
SET @sql_orderby = ''
IF @OrderBy = 5 /* Name: A to Z */
SET @sql_orderby = ' p.[Name] ASC'
ELSE IF @OrderBy = 6 /* Name: Z to A */
SET @sql_orderby = ' p.[Name] DESC'
ELSE IF @OrderBy = 10 /* Price: Low to High */
SET @sql_orderby = ' p.[Price] ASC'
ELSE IF @OrderBy = 11 /* Price: High to Low */
SET @sql_orderby = ' p.[Price] DESC'
ELSE IF @OrderBy = 15 /* creation date */
SET @sql_orderby = ' p.[CreatedOnUtc] DESC'
ELSE /* default sorting, 0 (position) */
BEGIN
--category position (display order)
IF @CategoryIdsCount > 0 SET @sql_orderby = ' pcm.DisplayOrder ASC'

--manufacturer position (display order)
IF @ManufacturerId > 0
BEGIN
IF LEN(@sql_orderby) > 0 SET @sql_orderby = @sql_orderby + ', '
SET @sql_orderby = @sql_orderby + ' pmm.DisplayOrder ASC'
END

Best Regards,
Stoyan Dobrev
Nop-Templates.com
Boyko
7 years ago
#12658 Quote
Avatar
  • Moderator
  • 1570
Hi guys,

Just continued our conversation in the nopCommerce forum since the same questions was added there and it doesn't seem to be related only to the Ajax Filters but with how the default nopCommerce search is working.
Regards,
Nop-Templates.com Team