Hi, there! I'm using a plugin to relate some K2 items. It can fetch most part of the data from K2 Database, but it does not work properly to get data from K2 Extrafield Select Type.
Right now, I'm using this code to retrieve the Extrafield values:
<?php $extraFld = array();
if ($XTlinkedItem->extra_fields)
{
$extraFields = json_decode($XTlinkedItem->extra_fields, false);
foreach ($extraFields as $key=>$extraField)
{
$extraFld[ $extraField->id ] = $extraField->value;
}
} ?>
And then using this shortcode I can show the Extrafield in Frontend:
<?php echo $extraFld[10] ?>
It works fine for Extrafields like Text or Date. But it won't show the right value for Select Type.
In K2 Database, this Extrafield has those names and values:
[{"name":"i3-10110U","value":"2","target":null,"alias":"modelointel","required":0,"showNull":1},{"name":"i3-1005G1","value":"3","target":null,"alias":"modelointel","required":0,"showNull":1}]
And when I save an item with this Extrafield, the itemt gets this id and value:
So, instead of showing the name "i3-1005G1", the plugin is showing just a number, in this case, the value "3", since its reading this in the K2 items table. My question is: how can I link those two informations so that the plugin can show the correct name?
Thanks in advance!
Regards.