Keyword

Newly added extra fields doesnt shows in items

More
10 years 5 months ago #121649 by jenci
Hi,
I have interesting problem:
- I have 1700+ items
- I have extra field (textarea), which is correctly assigned to the extra fields group, the group is correctly assigned to the category.
- the problem occurs when I create new extrafield (textarea), assign it to the current group, but this newly added extra field doesnt shows in item view (everything is setted up correctly ... showing extrafields atc ,), only shows the extrafield which is added 3months ago.
- if you go to the k2 item, the extrafields are there ...
BUT, If I open a k2 item, then I resave, the newly added extrafields shows in frontend.
I tried to clear cache, purge cache, check in, clear browser cache, publish/unpublish item, trash it than renew it, move it ... nothing. Only resaving helps, but I really dont want to open 1700+ items - save than close :S :blink:
Joomla! 2.5.14
K2 v2.6.6
PHP Version 5.3.27
Database Version 5.5.32-cll

Any idea appreciated , please help :(

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

  • Yiota
  • Yiota's Avatar
  • Visitor
10 years 5 months ago #121650 by Yiota
The extrafield you added doesn't contain any information for each item, it is blank. In the frontend empty extrafields do not show.
You can either remove the check part that prevents empty extrafields to show from the K2 item.php file located in your template overrides (read here getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates on how K2 overrides work if you don't use already) or just add it in each item you need it to show.

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

More
10 years 5 months ago #121651 by jenci
I modified the template code from
<?php // if($this->item->params->get('itemExtraFields') && count($this->item->extra_fields)): ?>
to
<?php if($this->item->params->get('itemExtraFields') ): ?>

and
from
<?php if($extraField->value != ''): ?>
to
<?php // if($extraField->value != ''): ?>

So empty fields should shown, but not.
Then checked in phpmyadmin the k2_items table, especially the extra_fields column, the I realized that newly added extrafields arent shown in [ { "id" : "idNr", "value":"..somestring " }] ... so I think "remove the check part that prevents empty extrafields to show from the K2 item.php ..' n my situation is useless.
After resaving item for testing purposes, the new item in the array was added ... and it was shown.
I dont have clue how to update thousand of items with new extrafield without resaving each of items ... :unsure:
Does exist any plugin which executes a resave function for ex. at the publish (from unpublish)method for the selected item? or I dont know :S ...

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

More
10 years 4 months ago #121652 by isherwood
I have the same issue. Any new information?

I've cleared Joomla's cache and my browser's cache. My new required field doesn't appear or get updated unless I open each item and re-save.

Thanks.

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

  • Yiota
  • Yiota's Avatar
  • Visitor
10 years 4 months ago #121653 by Yiota
I'm afraid that you cannot assign the new extra field in each item in any other way.

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

More
10 years 3 months ago #121654 by Harry Bevers
Replied by Harry Bevers on topic Re: Newly added extra fields doesnt shows in items
You can take a look at this commercial extension: extend.inceptive.gr/shop/k2-extensions/inceptive-extra-field-update-for-k2/
I was involved in the development of this plugin for a client with 1600+ K2 items. After adding a new extra field, all k2 items in the concerned extra fields group will be updated with the first (default) value.

Harry

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

  • Yiota
  • Yiota's Avatar
  • Visitor
10 years 3 months ago #121655 by Yiota
Thank you for sharing this @Harry Bevers.

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


Powered by Kunena Forum