TDLWebs Posted January 21, 2019 Share Posted January 21, 2019 Hi, I realise that categories can be dragged and dropped into order in the admin, but my client has literally hundreds (not an exaggeration) of sub-categories. Is there a way of sorting product categories in alphabetical order by default? If I remember rightly, I installed a mod for version 3 but there doesn't seem to be anything available for V6.2.2 Thanks, T Link to comment Share on other sites More sharing options...
bsmither Posted January 21, 2019 Share Posted January 21, 2019 I am reading what you want to do a couple of different ways: Permanently override the admin's arbitrary sort, or Affect a reset of the sort order to alphabetical, still allowing for an arbitrary sort. If to list child categories alphabetically, permanently, then: In the file catalogue.class.php, function getCategoryTree(), near line 756, find: if (($categories = $GLOBALS['db']->select('CubeCart_category', array('cat_parent_id', 'cat_id', 'cat_name'), array('cat_parent_id' => $parent_id, 'status' => 1, 'hide' => 0), 'priority, cat_name ASC')) !== false) { Change to: if (($categories = $GLOBALS['db']->select('CubeCart_category', array('cat_parent_id', 'cat_id', 'cat_name'), array('cat_parent_id' => $parent_id, 'status' => 1, 'hide' => 0), 'cat_name ASC')) !== false) { Link to comment Share on other sites More sharing options...
TDLWebs Posted January 22, 2019 Author Share Posted January 22, 2019 Thanks for that @bsmither, Yes, I am looking to override the arbitrary sort and list categories in alphabetical order permanently. So I have edited the file and cleared the cache but unfortunately it doesn't seem to be working, either in admin or on the front end. Any idea why? T Link to comment Share on other sites More sharing options...
traylor23 Posted July 11, 2019 Share Posted July 11, 2019 Not having any luck with this either. Had things under control through all of CC5, but now, it just won't do it. Frustrating. Also have hundreds of categories and sub_categories Link to comment Share on other sites More sharing options...
bsmither Posted July 11, 2019 Share Posted July 11, 2019 In addition to the above (which I think applies only to the "Shop by Category" menu structure), do this edit as well: In /classes/catalogue.class.php, near line 658 (for CC625): Find: if (($subcats = $GLOBALS['db']->select('CubeCart_category', false, array('cat_parent_id' => $category_id, 'status' => '1', 'hide' => '0'), array('priority'=>'ASC'))) !== false) { Change to: if (($subcats = $GLOBALS['db']->select('CubeCart_category', false, array('cat_parent_id' => $category_id, 'status' => '1', 'hide' => '0'), array('cat_name'=>'ASC'))) !== false) { This function gathers a given category's children that will eventually display as a collection of sub-category panels in that category's View Category page. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.