COMMUNITY FORUM
Extra fields of related items not available!
- Mohamed Abdelaziz
-
Topic Author
- Offline
- Platinum Member
- Joomla Developer
Less
More
10 years 2 months ago - 10 years 2 months ago #140751
by Mohamed Abdelaziz
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Extra fields of related items not available! was created by Mohamed Abdelaziz
Hi All,
More than a year ago, I wrote a small tutorial for how to make it possible to display extra fields of related items in the related items section, by hacking components/com_k2/models/itemlist.php, you can read it here: www.joomreem.com/joomla-developer-s-tips-and-tricks/item/51-how-to-show-extra-fields-for-k2-related-items.html
Then, I received a suggestion to convert this hack into a plugin, which is very interesting to me, after I started to develop this plugin, I found it is very easy to include this feature in core K2, without any more plugins.
I will be happy if K2 developers agreed to include this small hack in a coming release, just in case K2 community needs it.
The simple solution is just to modify components/com_k2/models/item.php, replace the below code, line ~181:
With the following:
So, it is just ORing $view == 'relatedByTag' to allow getting extra fields of related items.
More than a year ago, I wrote a small tutorial for how to make it possible to display extra fields of related items in the related items section, by hacking components/com_k2/models/itemlist.php, you can read it here: www.joomreem.com/joomla-developer-s-tips-and-tricks/item/51-how-to-show-extra-fields-for-k2-related-items.html
Then, I received a suggestion to convert this hack into a plugin, which is very interesting to me, after I started to develop this plugin, I found it is very easy to include this feature in core K2, without any more plugins.
I will be happy if K2 developers agreed to include this small hack in a coming release, just in case K2 community needs it.
The simple solution is just to modify components/com_k2/models/item.php, replace the below code, line ~181:
//Extra fields
if (($view == 'item' && $item->params->get('itemExtraFields')) || ($view == 'itemlist' && ($task == '' || $task == 'category') && $item->params->get('catItemExtraFields')) || ($view == 'itemlist' && $task == 'tag' && $item->params->get('tagItemExtraFields')) || ($view == 'itemlist' && ($task == 'search' || $task == 'date') && $item->params->get('genericItemExtraFields')))
{
$item->extra_fields = $this->getItemExtraFields($item->extra_fields, $item);
}
With the following:
//Extra fields
if ((($view == 'item' || $view == 'relatedByTag') && $item->params->get('itemExtraFields')) || ($view == 'itemlist' && ($task == '' || $task == 'category') && $item->params->get('catItemExtraFields')) || ($view == 'itemlist' && $task == 'tag' && $item->params->get('tagItemExtraFields')) || ($view == 'itemlist' && ($task == 'search' || $task == 'date') && $item->params->get('genericItemExtraFields')))
{
$item->extra_fields = $this->getItemExtraFields($item->extra_fields, $item);
}
So, it is just ORing $view == 'relatedByTag' to allow getting extra fields of related items.
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Last edit: 10 years 2 months ago by Mohamed Abdelaziz.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 2 months ago #140765
by Krikor Boghossian
Replied by Krikor Boghossian on topic Extra fields of related items not available!
Please Log in or Create an account to join the conversation.
- Mohamed Abdelaziz
-
Topic Author
- Offline
- Platinum Member
- Joomla Developer
10 years 2 months ago #140938
by Mohamed Abdelaziz
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Replied by Mohamed Abdelaziz on topic Extra fields of related items not available!
I have created one and it is merged, thanks Krikor!
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 2 months ago #140953
by Krikor Boghossian
Replied by Krikor Boghossian on topic Extra fields of related items not available!
You 're welcome :)
Please Log in or Create an account to join the conversation.
- Joe Campbell
-
- Offline
- Platinum Member
Less
More
- Posts: 438
9 years 6 months ago #148716
by Joe Campbell
Replied by Joe Campbell on topic Extra fields of related items not available!
Has this been added to 2.7 or 3?
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
9 years 6 months ago #148722
by Krikor Boghossian
Replied by Krikor Boghossian on topic Extra fields of related items not available!
Everything in this repo is 2.7
Please Log in or Create an account to join the conversation.