0

In com_content I can call my fields one by one as follows

<?php echo $this->item->jcfields[3]->value; ?>

The same code does not work in com_contacts. How can I call the fields in a custom override in com_contacts?

  • What do you get if you var_dump($this->item);? – Lodder Jun 17 '18 at 10:34
  • If I do that I get null – Eoin Jun 17 '18 at 11:15
  • I also get null if I var_dump $params – Eoin Jun 17 '18 at 12:13
1

You may find this helpful, I did.

https://docs.joomla.org/J3.x:Adding_custom_fields/Overrides

It has been years, but if you examine your array you will find the proper value of [#]. You can then modify your code.

Add this at the bottom of your override to see the contents of the array:

snippet: echo '<pre>'; print_r($array); echo '</pre>';

  • I already know about this. Did you use it on com_contact? – Eoin Jun 16 '18 at 21:29
  • Ah I think you helped me. I see the array now which made me realise my field is in fact a multiple select list, so an array within an array. – Eoin Jun 17 '18 at 11:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.