Keyword

k2 related items in category_item.php

More
8 years 3 months ago #155427 by jim
I have the following code which I use within the k2 template file 'item.php'

<?php echo $this->relatedItems[0]->title->value ;?>

Id simply like to use this same code in the k2 template file 'category_item.php'

Ive found the function 'getRelatedItems' in components/com_k2/models/itemlist.php and copied this to components/com_k2/models/item.php but this hasn't helped.

If anyone has any ideas, id really appreciate it thanks!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 3 months ago #155447 by Krikor Boghossian
Replied by Krikor Boghossian on topic k2 related items in category_item.php
Hacking the core is not recommended and can lead to unexpected errors.
The related items are not available in the itemlist views.
I would suggest using an extension or a K2 plugin instead.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

More
8 years 3 months ago - 8 years 3 months ago #155508 by jim
Replied by jim on topic k2 related items in category_item.php
Hi Krikor,
Many thanks for your reply/help!

Could you possibly suggest an extension/k2 plugin that might do the trick? Ive looked but haven't found anything.

Basically, what im aiming to achieve is, simply a count (only the integer) of related items on each item on category view.

Many thanks in advance!
Last edit: 8 years 3 months ago by jim.

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

More
8 years 3 months ago #155521 by Alex B.
Replied by Alex B. on topic Module to show related K2 items

Krikor wrote: I would suggest using an extension or a K2 plugin instead.

jim wrote: Could you possibly suggest an extension/k2 plugin that might do the trick? Ive looked but haven't found anything.
Many thanks in advance!


I can recommend RAXO Related K2 Items module which is specially designed to show related content for K2.

Description from the site:
RAXO Related K2 Items is a convenient module that automatically shows a list of K2 items related to the current entry, introducing your reader to the relevant content from around your K2 site. Be sure that every occasional visitor from Google gets enough interesting items to read and stay on your site forever.
RAXO Related K2 Items suggests various ways to find related content – by keywords, by tags, by author or by category. So you can be sure that every of your K2 items will get attention. This functional module is able to find the match for every single item to keep your reader engaged and increase your page views.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 3 months ago #155525 by Krikor Boghossian
Replied by Krikor Boghossian on topic Module to show related K2 items
Hello Alex,

If it can be triggered in category views then it will fit Jim.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

More
8 years 3 months ago #155531 by jim
Replied by jim on topic Module to show related K2 items
@Krikor, many thanks, could you possibly clarify what you mean by triggered in category view, yes this is what i need I believe just simply the get related items function in the relevant file.

@Alex, many thanks, although that module is quite expensive at 25$ and im unsure/doubtful at this stage if it will provide the very simple count of related items for each item on category view

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

More
8 years 3 months ago #155532 by Alex B.
Replied by Alex B. on topic Module to show related K2 items
@jim
Hmmm, it looks like I got your task not correctly.
This module doesn't show up on category pages, only on K2 item pages.
So no, it won't fit you.

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

More
8 years 3 months ago - 8 years 3 months ago #155537 by jim
Replied by jim on topic Module to show related K2 items
@Alex no worries, thanks anyway, I thought so.
Is anoying how difficult such a simple requirement is proving to be.

@Krikor sorry to bother you again, but i dont suppose you know the file I need to copy the function get relateditems to do you?
Last edit: 8 years 3 months ago by jim.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 3 months ago #155538 by Krikor Boghossian
Replied by Krikor Boghossian on topic Module to show related K2 items
You have to copy the related functions from the items model like you did.

The you would have to copy the code from the item.php to the category_item.php.

Keep in mind that depending on the context $item and $this->item might be used.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

More
8 years 3 months ago #155546 by jim
Replied by jim on topic Module to show related K2 items
Hi Krikor,

Thanks again for your reply/help much appreciated! :)

Sorry to bother you again, I was just wondering if you know where abouts I have to copy the related function to, im must be not putting it in the correct place/file, as im not having any luck with it here.

Many thanks if can possibly help!!!

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


Powered by Kunena Forum