Categories sort order by name

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
14 лет назад
Hello,

I'm new to nopcommerce and I'm considering using it for a projet for a technical books webshop.

There will be sereral hundreds sub-catogories, mainly car brands as first level sub-catogories and car models as second level sub-categories.

What makes sense is to sort by manufacturer, and then by models, on names (without having to input a sort order number corresponding to the alphabetic position).

It seems that by default, nopcomerce sorts categories and sub-categories by sort order and then categoryid, which is not very usefull (that means that you have to create the categories in the same order that you want to display them)

So my question is - would it be possible to have the category name as secondary sort order field when the sort order field is not specified or same for 2 categories ? ; in other terms sorting on sort_order + categoryname

Thanks
14 лет назад
Would just need to alter the stored procedure that loads the categories.

  SELECT *
  FROM [Nop_Category]
  WHERE (Published = 1 or @ShowHidden = 1) and Deleted=0 and ParentCategoryID=@ParentCategoryID
  order by DisplayOrder

changed order by to DisplayOrder, Name

Hope that helps.
Thanks,
Matthew
14 лет назад
Thanks for the quick answer, Matthew,

But is that a change that the core team might include in a future release ? I cannot see any drawbacks doing so.

I'd prefer not to fork too soon !

Benoit
13 лет назад
I'm having trouble finding this stored procedure. what is the name of this store procedure? is 1.8 using this?
13 лет назад
I ended up finding my solution here:
https://www.nopcommerce.com/boards/t/5049/helpful-tip-on-re-alphabetizing-categories.aspx

This is a bit more challenging because I have over 1200 categories but with a little excel

SELECT     CategoryID, ParentCategoryID, Name, Published, DisplayOrder
FROM         Nop_Category
ORDER BY DisplayOrder

copying the 'parentCategoyID' into excel

then using Concatenation to merge the 'parentcategoryID to the end of 'SELECT CategoryID, Name, ROW_NUMBER() OVER (ORDER BY Name) AS 'RowNumber' FROM Nop_Category WHERE ParentCategoryID='

I was able to run about 1200 queries right away.

this is a round about way but it worked quickly.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.