Keyword

Extra fields in latest_item

  • Zebra Film
  • Zebra Film's Avatar Topic Author
  • Offline
  • New Member
More
11 years 9 months ago #108098 by Zebra Film
Extra fields in latest_item was created by Zebra Film
I have made some big changes/overrides to the item.php file to show a lot of extra fields in exactly the way I wanted. I have used this guide for it: jbeginner.com/tutorials/extensions/how-to-display-k2-extra-fields/
Worked great.

No my client want to display the latest item, but exactly in the same layout as the item view. (as home page)

I have used the newest item /category in the menu to point there and tried to modify the latest_item.php to get the same results but it seems the extrafield code I use in item.php does not work there.

I wish there was a simple way to just point a menu to the latest item but I can't find that.

If I use the methode I described above, how can I show the extrafields from the latest item?
(and yes I have extra fields on in the categorie I am trying to view.)

Bastiaan

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

  • olsen
  • olsen's Avatar
  • Offline
  • Elite Member
  • Joomla and K2 Freelancer
More
11 years 9 months ago #108099 by olsen
Replied by olsen on topic Re: Extra fields in latest_item
You dont see the extrafields because they are not rendered by the component itself. If you see the "latest item from" menu options, you will see that there is not any param to show extrafields.

There could be a posibility to show extrafields with some change at the K2 core, but you know....

Didn't solve your issues?? Why dont you consider hire me? Email me or contact me www.xevedigital.com for details

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

  • Zebra Film
  • Zebra Film's Avatar Topic Author
  • Offline
  • New Member
More
11 years 9 months ago #108100 by Zebra Film
Replied by Zebra Film on topic Re: Extra fields in latest_item
Thanks, was afraid of this :-(

Any alternative welcome.

Bastiaan

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

More
11 years 9 months ago #108101 by Ardiansyah
Replied by Ardiansyah on topic Re: Extra fields in latest_item
hello Bastiaan

i have same problem, have you get the solution

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

  • Zebra Film
  • Zebra Film's Avatar Topic Author
  • Offline
  • New Member
More
11 years 9 months ago #108102 by Zebra Film
Replied by Zebra Film on topic Re: Extra fields in latest_item
Hi, I managed to get my normal listing working but not yet the listing in the latest items.
If I have time and find a solution I will post it here.

Bastiaan

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

  • Zebra Film
  • Zebra Film's Avatar Topic Author
  • Offline
  • New Member
More
11 years 8 months ago #108103 by Zebra Film
Replied by Zebra Film on topic Re: Extra fields in latest_item
OK decided to get back on this because I really need to get this working.

I need to be able to display the latest item exactly as it is shown in 'plain' item view.
That means with all extra fields I use there.

Since they don't seem to render/show up in latest_item.php I need to find a way to get this working.

I see in the controllers -> item.php that there is a function called: function extraFields() which is probably needs to be called at some point.
Just copying it in the latest.php controller will not do the trick I assume, but would love to here some tips how to make this working. I don't mind hacking around although prefer to work with/in the overrides.

Bastiaan

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

  • Zebra Film
  • Zebra Film's Avatar Topic Author
  • Offline
  • New Member
More
11 years 8 months ago #108104 by Zebra Film
Replied by Zebra Film on topic Re: Extra fields in latest_item
OK found some more to get it working:
In the component models, item.php only loads the extrafields if the view is item (around line 176)

I have added:
Log in  or Create an account to join the conversation.

  • Agence culturelle départementale Dordogne-Périgord
  • Agence culturelle départementale Dordogne-Périgord's Avatar
  • Offline
  • Junior Member
More
11 years 7 months ago #108105 by Agence culturelle départementale Dordogne-Périgord
Replied by Agence culturelle départementale Dordogne-Périgord on topic Re: Extra fields in latest_item
Thank you VERY Much for this VERY useful information. You saved my day ! :)

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

More
11 years 7 months ago #108106 by Ardiansyah
Replied by Ardiansyah on topic Re: Extra fields in latest_item
thanks you are the man

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

More
11 years 6 days ago #108107 by SPProductions
Replied by SPProductions on topic Re: Extra fields in latest_item
Thank you Bastiaan!

After I found the //Extra fields code in the model> index.php, I duplicated the next few lines through $item->extra_fields = $this->getItemExtraFields($item->extra_fields, $item);
}
Then I added the
<?php if($this->item->params->get('itemExtraFields') && count($this->item->extra_fields)): ?>
code through the <?php endif; ?> to the template latest_item.php file and it worked!

After I selected the correct k2 template in the administrator the extra fields appeared!

However, I was hoping to use the lightbox pop up as my extra fields are links that open in popups.
I noticed that the modal.css does not load in the head of the latest items page as well as modal.js and mootools-more.js.

Looking at the model>item.php file, I see the code for "case 'lightbox' :" etc. on line 1474.
This is part of a function that starts on line 1317
function getItemExtraFields($itemExtraFields, &$item = null)

I would think that if you load extra fields that the function would load with all its goodies, but apparently that is not the case. I'm working on getting this right, but if anyone has any suggestions or solutions it would be much appreciated.

Dumb question, why doesn't K2 just allow the option to have extra fields in latest view by default?

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