Gossamer Forum
Home : Products : Gossamer Links : Discussions :

What is everybody doing to order their categories?

Quote Reply
What is everybody doing to order their categories?
Hello,

In the old days, when I wanted to place the categories in a specific order, it was simple to do by just adding extra html tags to the category name,
examples:
<!Z1>Articles
<!A1>French Cooking Recipes
<!A3>German Cooking Recipes
<!A2>Swiss Cooking Recipes

Would produce the list of categories on the links home page to come out such as

French Cooking Recipes
Swiss Cooking Recipes
German Cooking Recipes
Articles


However, along the years somewhere (or we've just forgotten it used to happen), the Title of each category page is now showing the <!Z1> or whatever tag we use, which of course might throw us out of search engine listings all together with them thinking we are trying to manipulate our listing in some way, or at best, looks like shnizzle to see the page name as <!A99>Dutch Cooking Recipes

So, what is everybody using to get their categories to show up in the order that they want them to show up?

Is there a plugin that I must save up for to purchase, or is there a known method of making the categories display in the order that the owner chooses for his system, or what? Obviously with a new site and one that is not intended to make us any money, as close to free as possible is my chosen method.

Thanks very much for your time and consideration.
Weston.
Quote Reply
Re: [Westin] What is everybody doing to order their categories? In reply to
Pretty simple actually :)

Add a new field via Database > Category > Properties > Add field

SortOrder
INT

...and then edit build_category_sort_order so you have this at the beginning:

SortOrder DESC, (then the rest of whats there already)

...and then just update your categories, with values like 1,2,3,4,5 etc - and it should show them in that order then :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] What is everybody doing to order their categories? In reply to
Andy wrote:
Pretty simple actually :)

Add a new field via Database > Category > Properties > Add field

SortOrder
INT

...and then edit build_category_sort_order so you have this at the beginning:

SortOrder DESC, (then the rest of whats there already)

...and then just update your categories, with values like 1,2,3,4,5 etc - and it should show them in that order then :)

Cheers

Yah had me doing okay until you got to the part about "edit build_category_sort_order", huh what? Where do I find this build_category_sort_order?

Sorry and thanks,
Quote Reply
Re: [Westin] What is everybody doing to order their categories? In reply to
Andy's suggested solution is perfect for your need.

Also for the last bit of problem, you will find "build_sort_order_category" option under Admin > Setup > Build Options

Hope this helps.

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] What is everybody doing to order their categories? In reply to
Hi,
Thanks for the assist.

Doesn't seem to work for me, can't quite figure out where I went wrong.

1. Created a new field in the Categories properties named SortOrder with a type of Int
2. In Setup, Build Options there is a item named: build_sort_order_category and it's contents is now: SortOrder DESC,isNew DESC,isPopular DESC,Title
3. went into each category in the browse menu and assigned a number to each category in the order I would want them
4. Did a build all

But the home page just shows the categories in alphabetical order still.

Did I miss a step somewhere?
Quote Reply
Re: [Westin] What is everybody doing to order their categories? In reply to
Also it messed up using the build all (in the step 4 above, I did a build changed), now I tried a build all, and it got to the point of building and came back with a can't something or other error with fetchrow bla bla bla.

I backed out the changes, removed the fied in the category properties, and removed the SortOrder Desc, from the sort order in the build options and now it's building the pages fine again. So...

I'll have to redo it again and get the exact error message, unless you see a step that I forgot to do from what I listed above.

I should also mention that I only gave numbers to the main categories (the ones that show on the home page) which makes me wonder if I have to actually give a sort order to all the categories, including the masses of sub categories. Which I'd really rather not do unless I have to, since I don't really care how they show up, it's just the home page categories that i care about.

Last edited by:

Westin: May 15, 2009, 7:38 PM
Quote Reply
Re: [Westin] What is everybody doing to order their categories? In reply to
If I am not mistaken, there are many reserve words. Not having tried to look up all of them, I can't tell you which one is reserved and which one is not.. hence I normally setup fields with names, which I am pretty sure would normally never be reserved..... so why not try doing this, instead of setting up new field like SortOrder rename it to categorysortingorder or mysortigorder (I think you get the idea) and then try it.

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] What is everybody doing to order their categories? In reply to
Tried different naming conventions used mistyvein as the category field name and added mistyvein DESC,isNew DESC,isPopular DESC,Title to the category sort line in setup, build options.

Ran build all and got:

Code:
A fatal error has occured:

Can't call method "fetchrow" on an undefined value at Links::Build::build_detailed line 529.

Please enable debugging in setup for more details.

Stack Trace
======================================
Links (30551): Links::environment called at /home/account/mydomain/admin/Links.pm line 751 with no arguments.
Links (30551): Links::fatal called at Links::Build::build_detailed line 529 with arguments
(Can't call method "fetchrow" on an undefined value at Links::Build::build_detailed line 529.
).
Links (30551): Links::Build::build_detailed called at /home/account/mydomain/admin/GT/Plugins.pm line 133 with arguments
(HASH(0x8cf7058)).
Links (30551): GT::Plugins::dispatch called at /home/account/mydomain/admin/Links/Build.pm line 30 with arguments
(GT::Plugins=HASH(0x8419898), build_detailed, CODE(0x8d8707c), HASH(0x8cf7058)).
Links (30551): Links::Build::build called at nph-build.cgi line 561 with arguments
(detailed, HASH(0x8cf7058)).
Links (30551): main::_build_detailed called at /home/account/mydomain/admin/GT/Plugins.pm line 133 with arguments
(HASH(0x8410d74)).
Links (30551): GT::Plugins::dispatch called at nph-build.cgi line 100 with arguments
(GT::Plugins=HASH(0x8419898), create_detailed, CODE(0x83e0150), HASH(0x8410d74)).
Links (30551): main::build_all called at nph-build.cgi line 58 with no arguments.
Links (30551): main::main called at nph-build.cgi line 42 with no arguments.

I'm still gonna guess that all categories and sub categories are going to need to have a number filled in, which the more I think about it, the less I really want to do that. As theres a couple hundred sub categories so trying to keep track of what is what, in the numbering scheme and the time involved to do them all might just outweigh the benefits of ordering them on the home page. Assuming having to number all the categories and sub categories is the problem in the first place.
Quote Reply
Re: [Westin] What is everybody doing to order their categories? In reply to
I was looking for build_category_sort_order but that's not in the build options, there is
build_sort_order_category
and
build_category_sort

But not a build_category_sort_order so I wonder which one Andy really means.

Putting mistyvein DESC, Name in the build_category_sort allows the build all to complete and it seems like they are sorted almost in the order I desired (might be the difference of stariting numbering with 0 vs starting with 1 will have to check it out.
Quote Reply
Re: [Westin] What is everybody doing to order their categories? In reply to
Yup, it needs to be in the "build_category_sort" part of setup, build options.

And it needs to be the opposite of Desc, else everything is numbered backwards and ordered from highest to lowest, (at least that's what it does on my system. When I change Desc to Asc, and build all, it's ordered correctly on the home page.

Thanks for the help folks, it's working now.
Quote Reply
Re: [Westin] What is everybody doing to order their categories? In reply to
Sorry, didn't remember the exact setup option - glad its working though.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] What is everybody doing to order their categories? In reply to
No problem.

I just have to laugh at myself for all those years that I was doing the <!a4> thing to the category names to try to order them.
Quote Reply
Re: [Westin] What is everybody doing to order their categories? In reply to
haha you're not the only one who does it (I've worked on tons of sites where they do that =))

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!