Hello, I've been trying for weeks to return the value of some extra field I have in a category. We would like to return them on the category_item.php template layout just under the header. The content of the extra field value that we want is a short description of the item.
I've been working with Gavick's support but we couldn't find the data of these fields on the database:
www.gavick.com/forums/university-joomla3/k2-layout-category-item-extra-field-42956
Here is the latest post from Gavick:
With a dump we could only retrieve these values:
(We are looking for the Extra Field 13 value, named "Résumé" / Alias: coursresume)
Here is the code used in category_item.php:
Maybe I am doing something wrong?
These are my extra field, they are used for the template Suivi_K2:
This is one of the category with the template Suivi_K2 assigned:
www.quebecguitare.ca/suivi/guyla ... -m-quebec/
This is one K2 Item under that category with the extra_field_13 that contains a value:
www.quebecguitare.ca/suivi/guylaine/cours-de-guitare-classique-de-mathis-m-quebec-1
--The ExtraField13 is named "Résumé" and within this K2 Item contains the following value that we should see in the header of the category_item layout: "Bonjour Lucie, voici le Suivi pour le cours de cette semaine. On a pratiqué les pièces pour le concert. Ça va bien aller, Mathis a très bien pratiqué.
J'ai remarqué que Mathis est maintenant capable de jouer plus fort. C'est très bien. Bravo Mathis!!"
Link site / section: www.quebecguitare.ca/suivi/
Thank you,
Regards
I've been working with Gavick's support but we couldn't find the data of these fields on the database:
www.gavick.com/forums/university-joomla3/k2-layout-category-item-extra-field-42956
Here is the latest post from Gavick:
I've tried with this code, but it has the same problem I was talking about before. Extra fields are not picked from database for this. I've checked dump for the whole item and the only place it's used is in search fields. Here is an image with the content of extra fields when the regular K2 display is used. As You see only 3 elements are there and all the rest is presented in dump as NULL.
This must be codded somewhere deeper in core K2 functions. I think K2 developers will be more suitable here to help.
With a dump we could only retrieve these values:
(We are looking for the Extra Field 13 value, named "Résumé" / Alias: coursresume)
object(stdClass)#974 (8) {
["id"]=>
string(2) "13"
["name"]=>
string(8) "Résumé"
["value"]=>
NULL
["type"]=>
string(8) "textarea"
["group"]=>
string(1) "2"
["published"]=>
string(1) "1"
["ordering"]=>
string(1) "3"
["alias"]=>
string(11) "coursresume"
}
[3]=>Here is the code used in category_item.php:
<?php $extrafields = array(); ?>
<?php if( is_array( $item->extra_fields ) ): ?>
<?php //convertArray to use ids as key
foreach($item->extra_fields as $extraFlds){
$extrafields[$extraFlds->id] = $extraFlds->value;
}
?>
<?php endif; ?>
<?php if ($this->item->params->get('catItemTitleLinked')): ?>
<a href="<?php echo $this->item->link; ?>"><?php echo $this->item->title; ?></a></br>
<?php if($extrafields[13]): ?>
<a href="<?php echo $this->item->link; ?>"><?php echo $extrafields[13]; ?></a>
<?php endif; ?>
<?php else: ?>
<?php echo $this->item->title; ?>
<?php endif; ?>Maybe I am doing something wrong?
These are my extra field, they are used for the template Suivi_K2:
Nom Groupe Type Publié(e) Id
Avatar du Prof
Alias: AvatarProf Suivi en ligne - K2 Image 9
Date du Cours
Alias: DateduCours Suivi en ligne - K2 Date 10
Résumé
Alias: coursresume Suivi en ligne - K2 Zone de texte 13
Théorie vue
Alias: Thorievue Suivi en ligne - K2 Zone de texte 12
Technique vue
Alias: Techniquevue Suivi en ligne - K2 Zone de texte 14
Répertoire
Alias: Repertoireauprogramme Suivi en ligne - K2 Zone de texte 15
Livre ou lecture
Alias: Livre Suivi en ligne - K2 Champ Texte 16
Écoute suggérée
Alias: disco Suivi en ligne - K2 Champ Texte 17
Lien Vidéo
Alias: video Suivi en ligne - K2 Lien 18
Paiement
Alias: paiement Suivi en ligne - K2 Options 19
Note
Alias: note Suivi en ligne - K2 Zone de texte 20
This is one of the category with the template Suivi_K2 assigned:
www.quebecguitare.ca/suivi/guyla ... -m-quebec/
This is one K2 Item under that category with the extra_field_13 that contains a value:
www.quebecguitare.ca/suivi/guylaine/cours-de-guitare-classique-de-mathis-m-quebec-1
--The ExtraField13 is named "Résumé" and within this K2 Item contains the following value that we should see in the header of the category_item layout: "Bonjour Lucie, voici le Suivi pour le cours de cette semaine. On a pratiqué les pièces pour le concert. Ça va bien aller, Mathis a très bien pratiqué.
J'ai remarqué que Mathis est maintenant capable de jouer plus fort. C'est très bien. Bravo Mathis!!"
Link site / section: www.quebecguitare.ca/suivi/
Thank you,
Regards