You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
I am not sure if this has been covered here. I checked the search and did not come up with anything.
If you want to set the order of how your categories are displayed, here is a quick and easy hack that does the job.
Step 1: Add a new field to your Category database in the DATABASE UTILITIES>MANAGE USER DEFINED COLUMNS.
Select the Category table and UPDATE
Add a new column named Category_order. Make it at textbox with 10 chars, and make it required.
Step 2: Edit the STE_CAT.PL file as follows:
//CODE
sub ste_cat_list {
&initialize_sub_add('ste_cat_list');
#########
######### This routine prints categories for display in listings.
#########
my $row = "";
$sql_statement = "
SELECT category_id,category_name
FROM category
WHERE category_splashdisp='Y'
";
my @category = database_call('category','SELECT',$sql_statement);
foreach $row(@category) {
($category_id,$category_name) = @$row;
$category_id_encoded = vars_urlencode($category_id);
&display_print('ste_cat_list');
} ######### End of foreach statement.
@category = ();
&initialize_sub_remove('ste_cat_list');
} ######### End of subroutine.
//End Edit
Simply add the code in above.
Making it work...
In each of your categories you will have a new field named category_order. Add the number in this field of the order that you want your categories to be displayed in your menu. This category order will be reflected in your sub-categories as well. There is some overhead with the ORDER BY SQL clause, but it should not be a great factor in categories.
This makes it a snap to order your categories.
Hope this helps.
Offline
Nice!
Offline
Thanks -
A point about numbering categories: Using numbers to order categories can be a bit misleading. "11" will show between "1" and "2" because these numbers are treated as text. You would be well-advised to order with letters instead.
Letters also allow you the flexibility to insert categories between existing categories easily due to the way SQL statement orders text. "ab" will fit neatly between "a" and "b." And yes, caps do matter.
Hope this helps,
Kevin
Offline
I would love to add this mod but I am scared to because we have 400 products / 70+ categories and if I screw something up we are hosed as a business.
Does anyone know how to SAFELY edit the MySQL Table and make it available to update all the product category orders. Key word SAFELY. I am relatively new. Here is our site -->
Offline
I added category_order and changed the cat.pl statement. For some reason, the categories are still not being sorted. Do all the category_order values have to be entered before the categories are sorted?
Offline
Ninja -
Yes. I suggest ordering by letters as follows:
a
aa
ab
ac
aca
acb
acc
acca
accb
accc
ab
You can also order your categories alpahbetically by title using the first 3 letters of the category name and more, if required to make them unique. In this mod, the category orders do not have to be unique.
Kevin
Offline
This is a great mod, but only seems to sort the catogory listing on the right menu, not the product catagory images displyed in the center. Any way to make the photos of the catagories follow the same order?
Heres an illustration...
dave
Offline
You would have to make the same changes in the subroutine that is displaying the categories in the center. Look at ste_cat_disp sub routine which is the subroutine which is producing the category display.
John
Offline
When you say edit the STE_CAT.PL file, do you mean that you download the file and edit it or is it editable somewhere in the admin? Pardon me, but I am new to this software and not a programmer.
Also, I am wondering if this fix will work for me. I have a menu of main category items. When you click on one of them (maple syrup) it shows three subcategories of maple syrup, all with pictures. Each picture is the same but the names of the syrup types are different. I want to reorder these names. Will this fix do this?
pbpub
Offline