I'm modifying /templates/CRM/Profile/Page/Listings.tpl to a specific customer need. The profile I need to show using that includes a Multiple Value custom field.

When I tried the Listing with a record (Contact ID) with more than one value in that custom field, is shown multiple times that Contact ID, each one with one value from the Multiple Value custom field.

I turned debug on and the $rows array really shows multiple entries, each one with one value from the Multivalue field.

No matter if I turn is_multi_summary => "1" on or off, it doesn't change anything.

The code from Listing.tpl I'm working on looks like that:

  {foreach from=$rows item=row name=listings}
  <div id="row-{$smarty.foreach.listings.iteration}" class="{* cycle values="odd-row,even-row" *} ppindiv">

    <p class="crm-{$columnHeaders.2.field_name}">{$row.2}</p>
    <div class="crm-{$columnHeaders.1.field_name}">{$row.1}</div>
    <p class="crm-{$columnHeaders.5.field_name}">{$row.5}</p>
    <p class="crm-{$columnHeaders.7.field_name}">{$row.7}</p>


Also, makes no difference if I use the original loop to show the values, like that:

  {foreach from=$row key=index item=value}
    {if $columnHeaders.$index.field_name}
      <p class="crm-{$columnHeaders.$index.field_name}">{$value}</p>
      {* $value *} 

Things still got duplicated.

Is it possible to says Smarty to show the Multivalue Field only once, with all the values inside? Like a localized "foreach"?

1 Answer 1


Answer or sort of.

First you cannot pass numbers as index ie. $columnHeaders.1.whatever smarty will print just $columnHeaders

Second, same applies for $rows, I guess it holds an array of arrays with perhaps an id for each array with the custom fields, or just an index, if that's the case you need to nest your loops.


{foreach from=$rows key=index item=row}
     {foreach from=$row key=field item=value}
        <p>{$field}: {$value}</p>

Hope that gives you a hint and helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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