Jump to content

Categories order


Guest Sal W

Recommended Posts

Hiya :D

I know that there are mods on cubecart.org to change the categories display to alphabetical but I just need to re-order them (not alphabetically) - is there a mod to do this? I have checked and checked and cannot find one. If there is one please could you tell me the name of it so I can do a search for it OR is there another way around this? Thank you very much!

Link to comment
Share on other sites

On cc.org go to the members list and search for Sir William. On his website he has the category re-order mod which I believe is the one you are looking for! :D

Ah found it, can't use it though because I need a free one, oh well back to the drawing board! Thanks though for the help, much appreciated!

Link to comment
Share on other sites

Not sure if there are any free mods :D

Why do you need a free one? I don't think it's that expensive but I guess it depends how much you require the ability to re-order categories :D

Link to comment
Share on other sites

Not sure if there are any free mods :)

Why do you need a free one? I don't think it's that expensive but I guess it depends how much you require the ability to re-order categories B)

:D Actually it depends on the fact that I have zero money at the moment after being burgled last week. :D

Link to comment
Share on other sites

Open /includes/contents/viewCat.inc.php

Find somewhere @ line 158

$productListQuery = "SELECT ".$glob['dbprefix']."CubeCart_cats_idx.cat_id, ".$glob['dbprefix']."CubeCart_cats_idx.productId, productCode, quantity, description, image, price, name, popularity, sale_price, stock_level, useStockLevel FROM ".$glob['dbprefix']."CubeCart_cats_idx INNER JOIN ".$glob['dbprefix']."CubeCart_inventory ON ".$glob['dbprefix']."CubeCart_cats_idx.productId = ".$glob['dbprefix']."CubeCart_inventory.productId WHERE ".$glob['dbprefix']."CubeCart_cats_idx.cat_id = ".$db->mySQLSafe($_GET['catId']);

Replace it with

$productListQuery = "SELECT ".$glob['dbprefix']."CubeCart_cats_idx.cat_id, ".$glob['dbprefix']."CubeCart_cats_idx.productId, productCode, quantity, description, image, price, name, popularity, sale_price, stock_level, useStockLevel FROM ".$glob['dbprefix']."CubeCart_cats_idx INNER JOIN ".$glob['dbprefix']."CubeCart_inventory ON ".$glob['dbprefix']."CubeCart_cats_idx.productId = ".$glob['dbprefix']."CubeCart_inventory.productId WHERE ".$glob['dbprefix']."CubeCart_cats_idx.cat_id = ".$db->mySQLSafe($_GET['catId'])." ORDER BY name ASC";

Link to comment
Share on other sites

Robert has posted again a solution for alphabetizing cats, I will post again the solution for placing them as you want them.

I agree with subten that commercial mods are worthwhile, depending on how much you value your own time and how skillful you are at making your own mods. I purchase mods regularly, and I am not wealthy. But, there is always a way to do it yourself.

If you want to change the order to have them appear in a specific order that you set, then you only need to understand that they are listed by cat id order in CubeCart - if you do not apply any of the alphabetizing mods.

To re-arrange the order listed, you only need to change the id for the cats.

Use phpMyAdmin to edit your database. Browse the table, CubeCart_categories and look for the cat_id column. Change the numbers to reflect the order you desire. Your categories are displayed according to this numerical order.

So you see, changing to a custom order is not difficult. However, it requires that you fiddle directly with the mySQL database. Be sure to backup the database before doing this, as you and only you will be responsible for any loss of data.

Please note that this solution HAS been posted before in these forums, by me and others, and could be found with a little digging through search returns.

Also, note that the mod mentioned above by subten allows easy sorting through admin screens, as well as sorting product listings, etc. and is a very robust program for little money, IMO. I have no interest in selling it and am not really pushing it, except that some people are fearful of fiddling with the database and admittedly, making mistakes with the database can create more problems.

Hope this helps,

Mark

Link to comment
Share on other sites

Another option would be to add a category image for each one, and name each image with a number or letter reflecting the order you want (asc or desc). Then change the text as shown in RED. (includes/boxes/categories.inc.php.).

So if your cat images are called:

012-categoryA.jpg

018-categoryB.jpg....

The will be in that order.

+--------------------------------------------------------------------------

| categories.inc.php

| ========================================

| Categories Box

+--------------------------------------------------------------------------

*/

if (ereg(".inc.php",$HTTP_SERVER_VARS['PHP_SELF'])) {

echo "<html>\r\n<head>\r\n<title>Forbidden 403</title>\r\n</head>\r\n<body><h3>Forbidden 403</h3>\r\nThe document you are requesting is forbidden.\r\n</body>\r\n</html>";

exit;

}

// query database

$results = $db->select("SELECT cat_name, cat_id FROM ".$glob['dbprefix']."CubeCart_category WHERE cat_father_id = 0 ORDER BY cat_image ASC");

Link to comment
Share on other sites

  • 1 month later...
Guest taylor

If your product codes are not especially meaningful... you can have control over the exact category page product order by updating the viewCat include file to sort asc or dsc by product code. So if asc by code, then the product you want to be first could be code 1000, second 2000 (or any number 1001 or higher), and so on.

Link to comment
Share on other sites

  • 3 months later...

Mark, thanks for the post. Like the original poster, I too need to customize the order of the product categories in the left-hand column on the homepage. So I changed the values of category.cat_id, but it had no effect upon the order of the categories. To see why this might be happening, I looked at /includes/contents/viewCat.inc.php, and saw no instances of any ordering being done using the values of category.cat_id. So it would appear that the original alphabetical ordering -- which is done in that first query, "SELECT * FROM ".$glob['dbprefix']."CubeCart_category WHERE cat_father_id = ".$db->mySQLSafe($_GET['catId'])." ORDER BY cat_name ASC" -- is not overridden later by the values of category.cat_id. Or am I looking in the wrong place? Any help on this would be appreciated, as I really would like to customize the category ordering.

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