markThomas Posted January 27, 2014 Share Posted January 27, 2014 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 Quote Link to comment Share on other sites More sharing options...
bsmither Posted January 27, 2014 Share Posted January 27, 2014 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. Quote Link to comment Share on other sites More sharing options...
markThomas Posted January 27, 2014 Author Share Posted January 27, 2014 Thanks bsmithers, I will pass on the drag and drop method. M Quote Link to comment Share on other sites More sharing options...
traylor23 Posted February 1, 2014 Share Posted February 1, 2014 Is there a way to have the default drag and drop selection sorted by cat_name instead of the cat_id? Quote Link to comment Share on other sites More sharing options...
bsmither Posted February 1, 2014 Share Posted February 1, 2014 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. Quote Link to comment Share on other sites More sharing options...
markThomas Posted February 1, 2014 Author Share Posted February 1, 2014 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...!) Quote Link to comment Share on other sites More sharing options...
markThomas Posted February 1, 2014 Author Share Posted February 1, 2014 Ah, got it to refresh and categories are now listed by alpha. Still am I going to be reworking all these code edits with every update? Quote Link to comment Share on other sites More sharing options...
bsmither Posted February 1, 2014 Share Posted February 1, 2014 Probably. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.