Show custom fields in results

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

#
Hi!

Andrey how to show custom fields in item at results view?

In my com_content category i use this:

<?php
foreach($this->item->jcfields as $jcfield){
$this->item->arbitrary_property_name[$jcfield->name] = $jcfield;
} ?>

<div class="yt_custom"><i class="far fa-calendar-alt" aria-hidden="true"></i> <div class="raxo_custom_fields"><?php echo $this->item->arbitrary_property_name->value; ?> </div></div>
<div class="yt_custom"><i class="fas fa-map-marker-alt" aria-hidden="true"></i> <div class="raxo_custom_fields"><?php echo $this->item->arbitrary_property_name->value; ?> </div></div>
<div class="yt_custom"><i class="fas fa-globe" aria-hidden="true" ></i> <div class="raxo_custom_fields"><?php echo $this->item->arbitrary_property_name->value; ?> </div></div>

I tried to add this gsearch_blog_item.php but its dont work.

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

#
Hello, Ruslan.

Please, try to check gsearch_blog_item.php (at the top):

You can use this example code:

//you can call some field with $fields->{"name"}->title and $fields->{"name"}->value
//e.g.
echo $fields->{"test1"}->title . ' - ' . $fields->{"test1"}->value;

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

#
Spasibo! Works perfectly!

It must be added in documentation. Very usefull feature