Jump to content

Category Sort Asc by Default?


TDLWebs

Recommended Posts

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

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

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

  • 5 months later...

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...