Keyword

Solution to bug in K2 Tools Archive for selecting a specific cathegory

  • Cristian Prisacariu
  • Cristian Prisacariu's Avatar Topic Author
  • Offline
  • New Member
More
14 years 2 months ago #88288 by Cristian Prisacariu
Hello,It was a bug until now in K2 tools when using it as an archive. It worked only with no selection of cathegories in the field "Category filter". When you were selecting a specific cathegory then there was no display in the module on the frontend.The bug is from a forgotten space. A classic typo.To repair search for the file modules/mod_k2_tools/helper.php and here for the line that reads " $query .= "ORDER BY created DESC"; "the problem is that you need to add a space in front of ORDER, to look like " $query .= " ORDER BY created DESC"; "because if it enters the if from before it does not add this space. One can add this space in the if also.Hope it helps other and that this bug will be solved in the next K2 tools version.best wishes,cristian

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

More
14 years 2 months ago #88289 by nicholas marsh
I really want to create an archive that includes the sub categories and a main categories. At the moment you only appear to be able to link a specific category - it's child items are ignored. i think this is the same issue as covered here:-
www.toolboxcreations.com/articles/development/69-show-multiple-categories-in-the-k2-archive-list

I realy need some guidance on fixing this.

Help!

Thanks

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

More
13 years 9 months ago #88290 by Bram Van Grimberge
Sorry to revive this topic, but I still seem to have this bug. I looked up the code as explained in the first post but it seems the previous bug is 'fixed'.

 

The only way I can get the archive to work is by selecting no category at all. As soon as I select a single category the archive does not show up anymore.

 

Does anyone else have this problem?

 

I'm using K2 V2.4.1

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

More
13 years 2 months ago #88291 by Roy Vincent Niepes
Are you still looking for a fix for archive to include the sub categories?

check this out www.niepes.com/blog/web/how-to-make-the-k2-archive-includes-the-sub-categories


Bram Van Grimberge said:

Sorry to revive this topic, but I still seem to have this bug. I looked up the code as explained in the first post but it seems the previous bug is 'fixed'.

 

The only way I can get the archive to work is by selecting no category at all. As soon as I select a single category the archive does not show up anymore.

 

Does anyone else have this problem?

 

I'm using K2 V2.4.1

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

More
11 years 3 months ago #88292 by Christina Martin
I'm afraid this still seems to be a problem in v2.6.7 of k2. To summarise, I have a category of Blog, with sub-categories A, B and C. If I filter the Archive setting by Blog, the Archive disappears off my Blog page. If I set the filter to "none" it displays beautifully.

This solution ("check this out www.niepes.com/blog/web/how-to-make-the-...s-the-sub-categories") is no longer valid, and a search of that site doesn't reveal anything.

This suggested solution is still current ("i think this is the same issue as covered here:-
www.toolboxcreations.com/articles/develo...-the-k2-archive-list") but it was written for v2.3 and I'm struggling to apply it to the current files.

Has anyone got a recent solution to this?

Thanks in advance,

Christina

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

More
11 years 3 months ago #88293 by Ruth Cheesley
I have this partially fixed.

Follow the tutorial here:

www.toolboxcreations.com/articles/development/69-show-multiple-categories-in-the-k2-archive-list

Change your archive settings in the XML file:
<field name="" type="header" default="K2_ARCHIVE_SETTINGS" label="" description=""/>
                <field name="archiveItemsCounter" type="radio" default="1" label="K2_ITEMS_COUNTER" description="">
                    <option value="0">K2_HIDE</option>
                    <option value="1">K2_SHOW</option>
                </field>
		<field name="inccatid" type="text" default="" label="Category IDs"
description="Choose the category IDs, separated with a comma." />

Note the use of field name and not param name.

Insert this around line 184 of the helper file (just before the month declarations)
$inccatid = trim( $params->get('inccatid') );
if ($inccatid)
{
$cids = explode( ',', $inccatid );
JArrayHelper::toInteger( $cids );
$query .= ' AND (catid=' . implode( ' OR catid=', $cids ) . ') ';
}

I have the same problem mentioned on the blog post - I can't get the links to filter down by the specified categories.

We need to change this line:
				if ($params->get('archiveCategory', 0) > 0)
				{
					$row->link = JRoute::_(K2HelperRoute::getDateRoute($row->y, $row->m, null, $params->get('archiveCategory')));

To look at the comma separated list - I guess we have to explode that array, and iterate through somehow to say only show items from these categories.

Needs someone with more ninja-level skills to fix that part!

Ruth

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

More
11 years 3 months ago #88294 by Christina Martin
Thanks Ruth, much appreciated.

I came up with a work-around of only using K2 for the blog posts and keeping static content under the regular Joomla! content, but it isn't ideal. It works for the site I'm upgrading at the moment, but I have another to upgrade shortly that I will definitely need your solution for.

Regards,

Christina

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

More
11 years 1 month ago #88295 by TOTHOMweb
I've solved it for Joomla 3.1 mixing replies from this post and from www.toolboxcreations.com/articles/development/69-show-multiple-categories-in-the-k2-archive-list

First thing I did was open the mod_k2_tools.xml and add multiple="true" to the select categories field:
Log in  or Create an account to join the conversation.

More
11 years 1 month ago #88296 by TOTHOMweb
Small improvement...

with the above solution there is a crash if trying to show the counter. To solve this, in the same helper.php, arround line 939 change:
Log in  or Create an account to join the conversation.

More
10 years 9 months ago #88297 by Mateusz Nowak
TOTHOMweb: I did both changes you wrote and it almost succeeded. There is an option in backend to add more then one category but in frontend filter stopped working. Now it shows all K2 items from selected month. Any ideas what happened?

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