Hello,

I'm having a problem with getting data widouth an error from fields grouped with module Field Collection.

Here is the code and the error i get:

<?php
$collections
= field_collection_item_load_multiple($ids);
foreach(
$collections as $collection){
   
print_r($collection->$field_ingrediente);
}
?>

The collection is an "FieldCollectionItemEntity Object(...)" in this collection i ca see my field so i can print it or get values from it like this print_r($collection->$field_ingrediente); but i get a notice: Notice: Undefined property: FieldCollectionItemEntity::$field_ingrediente2 in cc_node_view() (line 114 of C:\xampp\htdocs\cc\sites\all\modules\cc\cc.module). where field_ingrediente2 is my cck field in field collection.

Is there a way to get rid of this notice or a better method to get the values from grouped fields with collection field module? And not with views please.

Thanks,

Comments

try it without the $

   print_r($collection->field_ingrediente);