Jump to content

Recategorizing Categories


Guest scotty1234

Recommended Posts

Scotty, this is a pretty easy fix. If you remove the sort, the subcategory items will display in the order entered into the database.

On line 52 of /includes/content/viewCat.inc.php, simply remove the following from the end of the line:

." ORDER BY cat_name ASC"

So the line should just be this:

$query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_category WHERE cat_father_id = ".$db->mySQLSafe($_GET['catId']);

Keep in mind, this is a hack! It will most likely be overwritten in an update.

brooky could easily incorporate a switch into the admin panel and make the sorting conditional. Perhaps a suggestion for future releases?

Link to comment
Share on other sites

Well, with that hack, the order would come from the order the categories were entered into the database. The only way to reorder would be either to reorganize the database manually* (do at your own risk) or remove the categories and enter them in the order you want them. Of course the inherent problem in that is what happens when you want to insert another category later.

Ideally, there would be an additional field in the catagory database which would designate display order. Then the View Category section in the Admin Panel would need to be rewritten to accommodate that order and facilitate changing it. The viewCat.inc.php would also require some modifications but it would be minimal. It would mainly just display based on perhaps three options, unsorted/raw, alpha sorted or designated order. That choice would be made in the General Settings of the CP.

* -- Be mindful that if you manually reorder the database, {dbprefix}_CubeCart_category, that you keep all the fields with each category, especially the cat_id and cat_father_id. If you mess that up in a populated store, it will rearrange all your categories unnecessarily.

Link to comment
Share on other sites

Guest scotty1234

HMMM. Sounds like it might be smarter to live with it until they make an option to do otherwise.

Thanks so much for your help and advice.

Scott

Link to comment
Share on other sites

Hmmm....upon thinking about it, I could just make a separate script to rearrange the categories in the database. This would work outside of CC3 and only require the one line change. It will be the easiest way to work without requiring major reworkings of existing CC3 files. This also makes it update proof for the most part, since only one line of one file will need to be edited.

Give me your thoughts on it and I'll see what I can do.

Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...

rosdi, the mod I have on my site will allow you to specify the order of all your categories and sub-categories. You can easily move any category up or down in the list. The people who are using it rave about it. Simply go to the link in my sig and it's available there.

Link to comment
Share on other sites

  • 2 weeks later...

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...