Jump to content

Category sort order


markThomas

Recommended Posts

I have look all over the forums and on the .org site for an answer. I have only found a commercial solution that address v5. Currently, the product categories on the home page are sorting by cat_ID, which is a function of when they were added to the database. 

 

I would like them to sort by alpha, by cat_name. 

There are other posts, but the solutions I find do not match the files for v5. 

 

This would appear to be a basic function within the CCart layout and so I surprised that there isn't an easy answer. So if you know of something that I have not found, please let me know. 

 

Thanks...

 

M

Link to comment
Share on other sites

CubeCart 5 allows for an arbitrary sort. When viewing the list of categories in admin, the Arrange column provides an icon that is used to grab and drag/drop in the order you want them to appear.

 

Of the functions I looked at in CC527, buildcategoriesDropDown() and getCategoryTree(), does fetch the categories, first sorted by 'priority', then on a priority tie, the cat_name in alpha order.

Link to comment
Share on other sites

The quickest solution is to adjust the query. In the CC527 file /admin/sources/categories.index.inc.php, near line 352, replace 'priority' with 'cat_name' and 'ASC' to 'DESC'.

 

Making any changes in the sort order using the drag-n-drop feature of the list will be undone the next time you bring up this list.

Link to comment
Share on other sites

hmmm, did not appear to make a difference. My line was 10 or so above yours. 

 

(You are using cc527, I am 5.2.5. When I update, will all the code changes we have made over the last few months be gone? i.e. cat_name on the downloads, Not Applicable on the inventory...!)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...