Sub-categories - a must

User avatar
ccondrup
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 219
Joined: Tue Aug 23, 2005 9:54 am
Location: Oslo

Re: Sub-categories - a must

Post by ccondrup » Fri Dec 16, 2005 11:18 am

I know, just expressing my view on it, and hopefully repeat some valid points as to why it is important.
What I think was not so clear: Yes, it's on the roadmap, no it will not be soon. Ok, but I want a quick and dirty hack in the meantime! Is it really that hard to put in one or two extra subcategories? Hardcoded if need to, just more than the two limiting levels  :-\
Did you know there's a Joomla irc channel? Chat to Joomla people live 24/7 - Join #joomla on the Freenode network ( irc.freenode.net )

toologic
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Tue Dec 13, 2005 9:03 pm

Re: Sub-categories - a must

Post by toologic » Fri Dec 16, 2005 1:54 pm

I'm sure thet in Joomla 2 will be released simple categorization system.

To start to change it is necessary already from version 1.x As these changes are very necessary all and are expected. (Respect to ccondrup)
Up to version 2 will be time and an opportunity diagnostic.


Otherwise Joomla will be remains CSM for one-page-sites!  :(

User avatar
louis.landry
Joomla! Ace
Joomla! Ace
Posts: 1388
Joined: Wed Aug 17, 2005 11:03 pm
Location: San Jose, California
Contact:

Re: Sub-categories - a must

Post by louis.landry » Fri Dec 16, 2005 2:01 pm

It is coming guys, just not this round.

Louis
Joomla Platform Maintainer
A hacker does for love what others would not do for money.

carlosdsantana2000
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri Dec 16, 2005 3:44 pm

Re: Sub-categories - a must

Post by carlosdsantana2000 » Fri Dec 16, 2005 3:58 pm

While waiting of categories of catergories, what do you think of the following workaround :

- create a section of all "parent" categories and another one of containing all sub-categories
- link by name a sub-category to its parent category via a parameter (for example : by entering PARENT_CATEGORY=the parent categroy name in the params column of the category table)
- write a php program to generate whatever you need by exploring the category table

This strategy can be applied endlessly.

Could someone experienced in Jommla comment this workaround ?

Thank you.

User avatar
louis.landry
Joomla! Ace
Joomla! Ace
Posts: 1388
Joined: Wed Aug 17, 2005 11:03 pm
Location: San Jose, California
Contact:

Re: Sub-categories - a must

Post by louis.landry » Fri Dec 16, 2005 10:57 pm

I think it is concievable for someone to write a custom content component to achieve whatever functionality they wanted.  That being said, here are some of my views on it.  The core content component needs to be completely reworked... But what i think everyone needs to understand is that the overall application needed to be reworked and cleaned up.  If the team had completely reworked the content component before now, they would have been reworking it towards and API that was certainly going to change.  Now that the groundwork has been laid down for a new, more object-oriented, efficient application framework the reworking of the content component can be redone without doubling the work.

Good things are coming...


Louis
Joomla Platform Maintainer
A hacker does for love what others would not do for money.

lejovchina
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 143
Joined: Thu Aug 25, 2005 8:20 pm

Re: Sub-categories - a must

Post by lejovchina » Mon Dec 26, 2005 1:03 pm

Hi all,

Since i could not wait for this major improvement to be made at a core level, i've decided to take a chance on a very neat hack called MultiCategories:

http://mamboforge.net/frs/?group_id=344&release_id=3609

It forced me to fallback to MOS 4.5.1, but so far it is behaving excellently in a brand new portal featuring dozens of Subcategories.

Before taking on this hack, i have tried several approaches to content organization. However, none suited the classical 2 levels depth Joomla/mambo provides by default.
I have also tried to reach the developer in order to ask for a possible upgrade to his code (i am not a PHP programmer). Until now he did not answer.

if anyone wants to make this transitional solution Joomla-compatible, we all would benefit from such effort.

hope someone finds this post handy.

Cheers,

Ljv.

pastoweb
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 134
Joined: Sun Nov 27, 2005 11:27 am
Contact:

Re: Sub-categories - a must

Post by pastoweb » Mon Dec 26, 2005 7:10 pm

Sounds very interesting...  :P
Having it J compatible would be great while waiting for this feature to be core implemented (I think maybe in one year or more).

stvn
Joomla! Apprentice
Joomla! Apprentice
Posts: 23
Joined: Mon Oct 17, 2005 2:07 pm

Re: Sub-categories - a must

Post by stvn » Wed Jan 04, 2006 3:45 pm

I'm desperatly needing this function so I'll give it a shot to port it to joomla. It appears to not touch the datamodel, so it shouldn't be too hard. No promises, but I'll keep you posted

stvn
Joomla! Apprentice
Joomla! Apprentice
Posts: 23
Joined: Mon Oct 17, 2005 2:07 pm

Re: Sub-categories - a must

Post by stvn » Wed Jan 04, 2006 4:10 pm

Hm it does modify the datamodel in a rather nasty way; DROP TABLE IF EXISTS `#__content` and some more table drops. So if I get it working it'll not be for the light hearted.

User avatar
louis.landry
Joomla! Ace
Joomla! Ace
Posts: 1388
Joined: Wed Aug 17, 2005 11:03 pm
Location: San Jose, California
Contact:

Re: Sub-categories - a must

Post by louis.landry » Wed Jan 04, 2006 4:35 pm

you shouldn't have to... the current category table has a field for parentid ... thats all that should really be necessary.  If it requires more fields then do a table ALTER command instead of dropping and re-creating.


Louis
Joomla Platform Maintainer
A hacker does for love what others would not do for money.

lejovchina
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 143
Joined: Thu Aug 25, 2005 8:20 pm

Re: Sub-categories - a must

Post by lejovchina » Wed Jan 04, 2006 6:18 pm

webImagery wrote: you shouldn't have to... the current category table has a field for parentid ... thats all that should really be necessary.  If it requires more fields then do a table ALTER command instead of dropping and re-creating.


Louis
Could you please elaborate a bit more on this topic?
If such field is already present in the table structure, how can i possibly enable it? Does it require any deep hacking, like the one behind MultiCategories?

Ljv.

User avatar
Hackwar
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 3783
Joined: Fri Sep 16, 2005 8:41 pm
Location: NRW - Germany
Contact:

Re: Sub-categories - a must

Post by Hackwar » Wed Jan 04, 2006 6:29 pm

He means that there is allready a field, but nothing else. Using that field, having any logic that enables multicategorie systems, is not implemented. You would have to create everything more or less from scratch.
god doesn't play dice with the universe. not after that drunken night with the devil where he lost classical mechanics in a game of craps.

Since the creation of the Internet, the Earth's rotation has been fueled, primarily, by the collective spinning of English teachers in their graves.

User avatar
louis.landry
Joomla! Ace
Joomla! Ace
Posts: 1388
Joined: Wed Aug 17, 2005 11:03 pm
Location: San Jose, California
Contact:

Re: Sub-categories - a must

Post by louis.landry » Wed Jan 04, 2006 6:45 pm

You would still have to rework the content component, all i meant was that if you are going to create a tree structure (unlimited categories) in the database, you really shouldn't need to change the database to achieve this since a field already exists (that isn't being used yet) for a parent category id.  And more importantly... if you wanted to make changes in a core table, i would suggest using an ALTER table query rather than a drop and create sequence. (though i must say altering core tables is probably not a good idea).

Louis
Joomla Platform Maintainer
A hacker does for love what others would not do for money.

stvn
Joomla! Apprentice
Joomla! Apprentice
Posts: 23
Joined: Mon Oct 17, 2005 2:07 pm

Re: Sub-categories - a must

Post by stvn » Wed Jan 04, 2006 8:22 pm

I'm very much aware that altering core table isn't a good idea, but like I said I am rather desperate :). It's good to know that in principle it can be done without altering core tables, so I'll try. The multicategory hacks com_content, com_category the administrator versions of them and includes/mambo.php

A question out of curiousity; it is said that it is hard to implement multicategory in joomla and that it probably will be postponed until after 1.1. But what is the real hard part? (so I know what I'm up against) I've obviously an easier task then the joomla hackers since I have a limited set of functionality that has to work with multi-category.

User avatar
Tonie
Joomla! Master
Joomla! Master
Posts: 16584
Joined: Thu Aug 18, 2005 7:13 am

Re: Sub-categories - a must

Post by Tonie » Wed Jan 04, 2006 8:30 pm

As far as I can tell, backwards compatibility is the biggest problem. Changing to a node based system will probably break the currently used structure.

User avatar
Hackwar
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 3783
Joined: Fri Sep 16, 2005 8:41 pm
Location: NRW - Germany
Contact:

Re: Sub-categories - a must

Post by Hackwar » Wed Jan 04, 2006 8:57 pm

The goal would also be to have a sturcture that works for all. Something where you can fit every content into. My idea of this is a node or tree structure that allows to sort the frontpage as a content item into the structure as you would be able to put a gallery into it. To have this overall structure instead of every component doing its own thing is the hard work.

My 0.02 $
god doesn't play dice with the universe. not after that drunken night with the devil where he lost classical mechanics in a game of craps.

Since the creation of the Internet, the Earth's rotation has been fueled, primarily, by the collective spinning of English teachers in their graves.

stvn
Joomla! Apprentice
Joomla! Apprentice
Posts: 23
Joined: Mon Oct 17, 2005 2:07 pm

Re: Sub-categories - a must

Post by stvn » Thu Jan 05, 2006 10:51 am

Very well, no need to alter any table indeed. I did a diff on mambo 4.5.1 and it turns out that there are only 7 files modified. I dropped those in a fresh 4.5.1 install and it worked without a problem.
Now I've dropped those in a fresh joomla 1.0.5 install and it looks promissing, some new functions of joomla are not working (hidemainmenu being one) but it does seem to have multi category now. Working to straight out the big bugs and then I'll release a first alpha on the hack.  :)

vavroom

Re: Sub-categories - a must

Post by vavroom » Fri Jan 06, 2006 12:25 am

stvn, yes, please do keep us updated, this sounds promising!
Does your solution also allow items to be placed at any levels of the section/category structure?
Does your solution also allow items to be associated to more than one category?

[me=vavroom]very interested[/me]

stvn
Joomla! Apprentice
Joomla! Apprentice
Posts: 23
Joined: Mon Oct 17, 2005 2:07 pm

Re: Sub-categories - a must

Post by stvn » Fri Jan 06, 2006 8:27 am

jay it is working :D
The original version made a tree overview of the category structure in a drop down list, which makes a poor overview button ;) So I've moved it to a column left to the list of content items.
It however does not supported multiple categories per content item, nor does it show the sub categories in the main admin menu.
A screen shot of the current version:
Image
Last edited by stvn on Fri Jan 06, 2006 8:56 am, edited 1 time in total.

vavroom

Re: Sub-categories - a must

Post by vavroom » Fri Jan 06, 2006 10:53 am

stvn wrote: It however does not supported multiple categories per content item
Ahh.  Too bad.  THat's really the functionality I need.  I can generally happily work and setup site structure in the section/category/item constraint, but mirroring content in several categories would be cool.

Thanks for the work on this.

lejovchina
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 143
Joined: Thu Aug 25, 2005 8:20 pm

Re: Sub-categories - a must

Post by lejovchina » Fri Jan 06, 2006 11:15 am

stvn, if you succeed in porting that multicategories hack to joomla, please publish the modified files together with installation notes.
what you have done so far already adresses some of my concerns
thanks for your work on this subject.

Ljv.

stvn
Joomla! Apprentice
Joomla! Apprentice
Posts: 23
Joined: Mon Oct 17, 2005 2:07 pm

Re: Sub-categories - a must

Post by stvn » Fri Jan 06, 2006 2:48 pm

First release.
I've put version 0.01 online here http://jana.geodan.nl/steveno/SubcatJoomla.zip be aware that this is an alpha release and it comes with no garanties. I've got it succesfully running on a fresh and empty joomla 1.0.5 setup. It is probably full of bugs and might break your site, although I believe as long as you have a decent backup of your site nothing really evil can happen.
I'm away for the weekend so don't expect any answers from me for the next couple of days. I've left my contact info in the readme included in the archive. Have fun with it.

w1x
Joomla! Intern
Joomla! Intern
Posts: 65
Joined: Mon Aug 22, 2005 10:02 pm

Re: Sub-categories - a must

Post by w1x » Fri Jan 06, 2006 4:43 pm

sorry if this question sounds really stupid but i've only had a quick skim through the topic so:

Can this above component allow you to add one news story to multiple categories?

lejovchina
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 143
Joined: Thu Aug 25, 2005 8:20 pm

Re: Sub-categories - a must

Post by lejovchina » Fri Jan 06, 2006 5:20 pm

w1x wrote: sorry if this question sounds really stupid but i've only had a quick skim through the topic so:

Can this above component allow you to add one news story to multiple categories?
No way.
This is not even a component but a provisional workaround.

I have also to report that i have tested the new J!1.0.5 port on a fresh install and it doesn't seem to work at all.

The category creation page does not display the extra field which would allow to put it in a hierarchy tree.

Ljv.

stvn
Joomla! Apprentice
Joomla! Apprentice
Posts: 23
Joined: Mon Oct 17, 2005 2:07 pm

Re: Sub-categories - a must

Post by stvn » Mon Jan 09, 2006 2:24 pm

New version at the same place, there were indeed some issues about the last release. I tested it on both a clean 1.0.4 and 1.0.5 by just copying the files to the joomla directory. It works for me.
To create a hierarchy tree you need to use the Parent Category field in category creation

Question for the moderaters: should I take this discussion somewhere else, and if so where?

lejovchina
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 143
Joined: Thu Aug 25, 2005 8:20 pm

Re: Sub-categories - a must

Post by lejovchina » Mon Jan 09, 2006 3:11 pm

stvn wrote: New version at the same place, there were indeed some issues about the last release. I tested it on both a clean 1.0.4 and 1.0.5 by just copying the files to the joomla directory. It works for me.
Your 1st ultra-early alpha had a misnamed folder, that is why i couldn't see any change :)
Thanks a lot for porting this goodie to J!, btw.
I definitely think this thread should be given more visibility, due to the massive request of sub/multicategories. This small fix already adress some issues many folks out there are desperatly seeking for.

LJv.

PS: I finally got rid of mambo 451 thanks to this enhancement  :D

stvn
Joomla! Apprentice
Joomla! Apprentice
Posts: 23
Joined: Mon Oct 17, 2005 2:07 pm

Re: Sub-categories - a must

Post by stvn » Tue Jan 10, 2006 1:01 pm

I found out that I want to allow items to be associated to more than one category as well. This does require a change in the datamodel I think, but looking at it made me think that it is a very minor one:
If I would use the catid field in a content item as a key to a link table which links the content item to categories I would be done right? I need to change a lot of SQL select statements to allow for the new join and I probably need to modify the interface as well. But it sounds doable.
Am I right in assuming that this is all that needs to be done, or am I forgetting something.

note that I don't need any backwards compatibility, nor should non core joomla modules and components work. It is of course desirable if that would be the case though.

stvn
Joomla! Apprentice
Joomla! Apprentice
Posts: 23
Joined: Mon Oct 17, 2005 2:07 pm

multple categories per item

Post by stvn » Wed Jan 11, 2006 10:25 am

I've got the first phase of multiple categories per item working  :laugh:
I've added a new table #__content_categories which is a table that has the fields categoryid and contentid. There I can map the many-to-many relations.
I modified the SQL statement in showBlogCategory to include: cc.id AS catid and
. "\n LEFT JOIN #__content_categories AS jcc ON a.id = jcc.contentid"
. "\n LEFT JOIN jos_categories AS cc ON cc.id = jcc.categoryid"
Finally I modifed the function _where so that it becomes: $where[] = "cc.id IN ( $id ) ";
This modifications are only in /components/com_content/content.php

The result of this is that index.php?option=com_content&task=blogcategory&id=16&Itemid=29
and index.php?option=com_content&task=blogcategory&id=17&Itemid=29 both show the item that is in category 16 and 17, but the one that is only in 17 shows up only in 17 :D

lejovchina
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 143
Joined: Thu Aug 25, 2005 8:20 pm

Re: Sub-categories - a must

Post by lejovchina » Wed Jan 11, 2006 10:55 am

stvn,

Congratulations!  ;)

i have a PROFOUND interest in your research work. If you can publish a min howto on your latest discoveries, it'd be more than welcome.

the COMMUNITY shall definitely focus more on this CORE functionality.

cheers and keep on the excellent job.

Ljv.

stvn
Joomla! Apprentice
Joomla! Apprentice
Posts: 23
Joined: Mon Oct 17, 2005 2:07 pm

Re: Sub-categories - a must

Post by stvn » Wed Jan 11, 2006 1:44 pm

Right now it involves quite some handwork, I've yet to think of a nice backend/administration interface and an SQL statement to install the new table and fill it with the current information on content/category linking.

But like I said the following steps have to be done to get it working on the frontpage:
Create a new table in the database #__content_categories (#_ being your prefix, usually jos):

CREATE TABLE `jos_content_categories` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`contentid` INT UNSIGNED NOT NULL ,
`categoryid` INT UNSIGNED NOT NULL ,
PRIMARY KEY ( `id` )
) TYPE = MYISAM ;

Fill the table by hand to get your content items and categories combined, i know need to get that in the admin tool :(


And apply the attached patch on my modified /components/com_content/content.php
This patch is solely meant for people who want to help develop this functionality, it's not nearly finished and totally unfit for production or even development environments where anything other than this functionality is being developed.  It probably breaks about everything that I have not yet tested (which is a lot) and it is not nearly finished. Once I have the backend and administration issues sorted out I'll post an official alpha release.
You do not have the required permissions to view the files attached to this post.
Last edited by stvn on Wed Jan 11, 2006 1:47 pm, edited 1 time in total.


Locked

Return to “Wishlists and Feature Requests - Archive”