CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Custom fields in default contribution/membership receipt showing as "Array"
Pages: [1] 2

Author Topic: Custom fields in default contribution/membership receipt showing as "Array"  (Read 2252 times)

gozer

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Wordpress 3.5
  • MySQL version: 5.5
  • PHP version: 5.3
Custom fields in default contribution/membership receipt showing as "Array"
February 01, 2013, 06:57:54 am
Is anyone else having this problem with the default contribution/membership receipts?  Any ideas what can be changed in the template to fix this?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Custom fields in default contribution/membership receipt showing as "Array"
February 01, 2013, 10:57:58 am

1. Are you on the latest version of civi, i.e. 4.2.7?

2. Can you create a contrib / member page with a simpler and smaller profile (just name and 1 custom field)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

gozer

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Wordpress 3.5
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Custom fields in default contribution/membership receipt showing as "Array"
February 01, 2013, 11:04:46 am
We're on 4.2.6 for Wordpress.  I'll upgrade, revert to default template, and test again.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Custom fields in default contribution/membership receipt showing as "Array"
February 01, 2013, 11:21:26 am

you might want to revert to default template and see if that works
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

gozer

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Wordpress 3.5
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Custom fields in default contribution/membership receipt showing as "Array"
February 01, 2013, 11:25:00 am
I'm using the default template.

gozer

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Wordpress 3.5
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Custom fields in default contribution/membership receipt showing as "Array"
February 04, 2013, 11:41:57 am
I've upgraded to 4.2.7.  After doing so, I reset the template back to default and tested again.  I'm still getting the same issue in the email receipts.

Seems to be the smarty array of these custom variables is not getting setup correctly.  I don't mind helping out and fixing it, but I'm having trouble finding exactly what file assigns the array.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Custom fields in default contribution/membership receipt showing as "Array"
February 04, 2013, 12:42:51 pm

can you try with a simpler profile with just a few fields and see if you can narrow down the issue that way

if you want to get into the code, you might want to read: http://book.civicrm.org/developer/ Jump on IRC if you need help getting started

thanx for looking into this

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

gozer

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Wordpress 3.5
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Custom fields in default contribution/membership receipt showing as "Array"
February 05, 2013, 07:38:55 am
I appreciate your attention to this, but I have a hard time believing it has anything to do with the number or type of custom fields. 

In every other respect, there's no problem with civi collecting and storing the data in those custom fields.  I believe the issue is isolated to the routine that prepares the array of custom variables and assigns the array to smarty to be used in that particular email template and in that particular loop.  Its as if the structure of the data being retrieved from the database is different than expected.  Therefore, the routine that prepares the data is simply putting the wrong label and value pairs together.  If I just knew where in the code that array is being built, it should be a relatively quick and easy fix.

gozer

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Wordpress 3.5
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Custom fields in default contribution/membership receipt showing as "Array"
February 20, 2013, 10:01:55 am
Any help as to where I might find the code generating that list?

Thanks,
Gary

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Custom fields in default contribution/membership receipt showing as "Array"
February 20, 2013, 10:17:03 am

check:

CRM/Event/BAO/Event.php, function sendMail

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

gozer

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Wordpress 3.5
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Custom fields in default contribution/membership receipt showing as "Array"
February 20, 2013, 11:10:51 am
I found where its being assigned to the smarty template, but it doesn't make sense.  Its assigning an integer value to the smarty variable, but its obviously replaced with an array somewhere.  I'm rarely have to deal with Smarty.  Are there filters, triggers, or events that ultimately use the custom_post_id to transform the variable into an array of custom values?

CRM/Contribute/BAO/Contribution.php

Code: [Select]
$template->assign('customPost', $values['custom_post_id']);

Template code:

Code: [Select]
     {if $customPost}
      <tr>
       <th {$headerStyle}>
        {$customPost_grouptitle}
       </th>
      </tr>
      {foreach from=$customPost item=customValue key=customName}
       {if ($trackingFields and ! in_array($customName, $trackingFields)) or ! $trackingFields}
        <tr>
         <td {$labelStyle}>
          {$customName}:
         </td>
         <td {$valueStyle}>
          {$customValue}
         </td>
        </tr>
       {/if}
      {/foreach}
     {/if}

« Last Edit: February 20, 2013, 11:13:20 am by gozer »

gozer

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Wordpress 3.5
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Custom fields in default contribution/membership receipt showing as "Array"
February 20, 2013, 11:32:44 am
I also found that CRM_Contribute_BAO_ContributionPage::buildCustomDisplay is called for the customPost fields, but does nothing to produce a label-value array.  But, it seems to work for "onBehalfProfile"
« Last Edit: February 20, 2013, 11:39:36 am by gozer »

Yashodha Chaku

  • Forum Godess / God
  • Ask me questions
  • *****
  • Posts: 755
  • Karma: 57
    • CiviCRM
Re: Custom fields in default contribution/membership receipt showing as "Array"
February 22, 2013, 12:21:16 am
gozer :

When 'On behalf of ' profile is used, the membership record is created for the Org and not the Individual,
hence it makes sense to collect the membership data in the On behalf of profile rather than custom pre/post profiles.

Since your Membership Details has all the fields of type 'Membership', I would recommend you to move all such fields to your On behalf of profile and that should fix it for you.

Hope that helps!
-Yashodha
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

gozer

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Wordpress 3.5
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Custom fields in default contribution/membership receipt showing as "Array"
February 22, 2013, 01:42:46 pm
I moved the fields over to the on behalf of profile and about to test.  But, now the Formatting - Free HTML fields no longer work under that profile.  They don't even appear in the HTML source.  We used that to create separate sections within the profile.

gozer

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Wordpress 3.5
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Custom fields in default contribution/membership receipt showing as "Array"
February 22, 2013, 01:55:45 pm
I also noticed that our first payment option is selected but you have to select a different payment option and then reselect the original one again for the payment fields to appear.

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Custom fields in default contribution/membership receipt showing as "Array"

This forum was archived on 2017-11-26.