Keyword

Items in Multiple Categories

  • Adam Rifat
  • Adam Rifat's Avatar Topic Author
  • Offline
  • New Member
More
14 years 8 months ago #68948 by Adam Rifat
Replied by Adam Rifat on topic Items in Multiple Categories
Or the other way that could be done is with a module.

E.g. a 'category content' module could simply pick out two or three items from a particular category and display intro text.

So the url would be set up as /editors-pick with a module published to that page which picks up either tagged articles or simply the articles could be specified by ID number in the module admin screen.

Either way would probably work and means the article is actually only published in ONE cat!

Please Log in or Create an account to join the conversation.

More
14 years 7 months ago #68949 by Ivan Descartes
Replied by Ivan Descartes on topic Items in Multiple Categories
This is such an important feature for K2, and the implementation is not impossible. First, I will say why this is important: Users should be able to navigate content listings, and find an item by different paths, without copying content between categories. So unless K2 can make NESTED TAGS (which would effectively be the same as multiple categories), this is still important. Think about Ebay or another retailer that puts links to items under "Bestsellers" and also "Video Games".

So how to implement? Here is the best way:

First, from the item creation, it can be assigned to multiple categories. 1 category is set as the primary category, and this category is stored in catid in the database (for compatibility). All other categories are stored in a new database table that maps items to categories by paths. The schema for this table:

ID (primary key) ItemID CatID PathID (optional)

The ID is just the primary key. The ItemID stores the article ID. The cat ID stores the CatID. The PathID is an optional parameter that reflects if this is path 1, path 2, path 3, .... to get to this item.

Any time an item is created, we make unique entries for each category assignment. This puts the database load on the item creation rather than search (if we had put all of the categories comma-separated in the original items table). When a category listing is requested, we just find all of the items in this Paths table that match, and list them. Other modules that use K2 should start using this table.

So for URLs, there is an SEO way and a non-SEO way, I want to highlight both, and suggest the SEO way.

SEO way: only 1 url per article. Unless some magical cookies or database are used, the page cannot reflect which category the user arrived by.
non-SEO way: multiple urls per article. This allows the URL to reflect the category that the viewer reached the item by. However, it also means that there are multiple URLs for the same item. This could be done simply by appending the "path" to the end of the URL to allow K2 breadcrumbs to properly display the path, or the whole url would be set correctly (the latter being preferable).

Let me know if this makes sense. The feature is quite important if K2 wants to be THE content solution.

Balgas said:If someone knows how create a second category for one item, i'm ok to know the solution :)

Please Log in or Create an account to join the conversation.

More
14 years 7 months ago #68950 by Ivan Descartes
Replied by Ivan Descartes on topic Items in Multiple Categories
Another way, which is much easier: Add catid2, catid3 .... catidx to the k2_items table. This would work well, but means that K2 will dictate how many categories an item can be added to. I think 3 categories is a reasonable limit. Of course, this results in a performance hit, since all of the fields in ITEMS must be checked for a listing, even if an item is only listed in 1 category. So in the worst case, where all items appear in just 1 category, there is a 3x hit. In the best case, where all items are in 3 categories, it is the same cost as the previous suggestion.

Please Log in or Create an account to join the conversation.

More
14 years 3 months ago #68951 by FidelGonzales
Replied by FidelGonzales on topic Items in Multiple Categories
Upon my first install, I have long awaited a content item to have the ability to exist within multiple categories. This is particularly important for proper content construction logic, as it is often inevitable that an article is applicable to multiple categories, especially in a medium to large website.

But, the only answer I have ever received from Fotis says it will never be done. Though, there are some great arguments for such capability in this thread and suggestions on how to get it done.

Please Log in or Create an account to join the conversation.

More
14 years 3 weeks ago #68952 by Abdul Muhaymin
Replied by Abdul Muhaymin on topic Items in Multiple Categories
Please explain step by step for beginners like us, the item copying sucks because it is copying attachments too and my hosting account space is getting low :(.. please help

Ivan Descartes said:This is such an important feature for K2, and the implementation is not impossible. First, I will say why this is important: Users should be able to navigate content listings, and find an item by different paths, without copying content between categories. So unless K2 can make NESTED TAGS (which would effectively be the same as multiple categories), this is still important. Think about Ebay or another retailer that puts links to items under "Bestsellers" and also "Video Games". So how to implement? Here is the best way:
First, from the item creation, it can be assigned to multiple categories. 1 category is set as the primary category, and this category is stored in catid in the database (for compatibility). All other categories are stored in a new database table that maps items to categories by paths. The schema for this table:

ID (primary key) ItemID CatID PathID (optional)

The ID is just the primary key. The ItemID stores the article ID. The cat ID stores the CatID. The PathID is an optional parameter that reflects if this is path 1, path 2, path 3, .... to get to this item.

Any time an item is created, we make unique entries for each category assignment. This puts the database load on the item creation rather than search (if we had put all of the categories comma-separated in the original items table). When a category listing is requested, we just find all of the items in this Paths table that match, and list them. Other modules that use K2 should start using this table.

So for URLs, there is an SEO way and a non-SEO way, I want to highlight both, and suggest the SEO way.

SEO way: only 1 url per article. Unless some magical cookies or database are used, the page cannot reflect which category the user arrived by.
non-SEO way: multiple urls per article. This allows the URL to reflect the category that the viewer reached the item by. However, it also means that there are multiple URLs for the same item. This could be done simply by appending the "path" to the end of the URL to allow K2 breadcrumbs to properly display the path, or the whole url would be set correctly (the latter being preferable).

Let me know if this makes sense. The feature is quite important if K2 wants to be THE content solution.

Balgas said:If someone knows how create a second category for one item, i'm ok to know the solution :)

Please Log in or Create an account to join the conversation.

More
14 years 3 weeks ago #68953 by irish
Replied by irish on topic Items in Multiple Categories
I think there is an issue with this due to the database and items having the same id. If you only create one item then that one item id cannot be assigned to more than one category as it is in joomla. I have searched and had someone work on this and was told it cannot be done in joomla. That was what I was told, however I still think it should be possible.

Please Log in or Create an account to join the conversation.

More
14 years 3 weeks ago #68954 by Abdul Muhaymin
Replied by Abdul Muhaymin on topic Items in Multiple Categories
The option is available in Zoo of Yoothemes, and attachments is problem


irish said:I think there is an issue with this due to the database and items having the same id. If you only create one item then that one item id cannot be assigned to more than one category as it is in joomla. I have searched and had someone work on this and was told it cannot be done in joomla. That was what I was told, however I still think it should be possible.

Please Log in or Create an account to join the conversation.

More
14 years 3 weeks ago #68955 by irish
Replied by irish on topic Items in Multiple Categories
Is Zoo a CCK component?

Abdul Muhaymin said:The option is available in Zoo of Yoothemes, and attachments is problem

irish said:I think there is an issue with this due to the database and items having the same id. If you only create one item then that one item id cannot be assigned to more than one category as it is in joomla. I have searched and had someone work on this and was told it cannot be done in joomla. That was what I was told, however I still think it should be possible.

Please Log in or Create an account to join the conversation.

More
14 years 3 weeks ago #68956 by Abdul Muhaymin
Replied by Abdul Muhaymin on topic Items in Multiple Categories
I think So, there is all functions, dont know deeper, and the worst is it is paid :D

Please Log in or Create an account to join the conversation.

More
14 years 3 weeks ago #68957 by irish
Replied by irish on topic Items in Multiple Categories
so it has the functions you want but you will not buy it? hmmm...

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum