Using joomla! 3.9.2
I have an article custom field, type List with the ID 14. The List values are below:
Text - Value
1 = 335,538,353,559
2 = 390,538,408,559
I am trying to pull the Value of the option 1 into a custom blog_item.php template.
I have had success getting the text value with:
<?php echo $this->item->jcfields['14']->value; ?>
If I try to get the rawvalue the output is Array.
If the custom field in the the article has 1 selected in the dropdown select how can I output the value 335,538,353,559 ?
-
<?php var_dump($this->item->jcfields['14']); ?>
=
object(stdClass)#1724 (32) { ["id"]=> string(2) "14" ["title"]=> string(18) "Select Desk Number" ["name"]=> string(16) "selectdesknumber" ["checked_out"]=> string(3) "465" ["checked_out_time"]=> string(19) "2019-02-01 14:02:34" ["note"]=> string(0) "" ["state"]=> string(1) "1" ["access"]=> string(1) "1" ["created_time"]=> string(19) "2019-01-24 08:13:33" ["created_user_id"]=> string(3) "465" ["ordering"]=> string(1) "0" ["language"]=> string(1) "*" ["fieldparams"]=> object(Joomla\Registry\Registry)#1644 (3) { ["data":protected]=> object(stdClass)#1647 (2) { ["multiple"]=> string(0) "" ["options"]=> object(stdClass)#1649 (2) { ["options0"]=> object(stdClass)#1648 (2) { ["name"]=> string(1) "1" ["value"]=> string(15) "335,538,353,559" } ["options1"]=> object(stdClass)#1650 (2) { ["name"]=> string(1) "2" ["value"]=> string(15) "390,538,408,559" } } } ["initialized":protected]=> bool(true) ["separator"]=> string(1) "." } ["params"]=> object(Joomla\Registry\Registry)#1646 (3) { ["data":protected]=> object(stdClass)#1652 (9) { ["class"]=> string(0) "" ["label_class"]=> string(0) "" ["show_on"]=> string(0) "" ["render_class"]=> string(0) "" ["showlabel"]=> string(1) "1" ["label_render_class"]=> string(0) "" ["display"]=> string(1) "0" ["layout"]=> string(0) "" ["display_readonly"]=> string(1) "2" } ["initialized":protected]=> bool(true) ["separator"]=> string(1) "." } ["type"]=> string(4) "list" ["default_value"]=> string(0) "" ["context"]=> string(19) "com_content.article" ["group_id"]=> string(1) "4" ["label"]=> string(18) "Select Desk Number" ["description"]=> string(0) "" ["required"]=> string(1) "0" ["language_title"]=> NULL ["language_image"]=> NULL ["editor"]=> string(13) "Authorname" ["access_level"]=> string(6) "Public" ["author_name"]=> string(13) "Authorname" ["group_title"]=> string(22) "Floor Plan - 3rd Floor" ["group_access"]=> string(1) "1" ["group_state"]=> string(1) "1" ["group_note"]=> string(0) "" ["value"]=> string(1) "1" ["rawvalue"]=> array(1) { [0]=> string(15) "335,538,353,559" } }
*updated to show jcfields instead of jcFields.
var_dump($item->jcFields['14']);
and add the result to your original question please?