3

Emails being generated from new members are now missing 'billingName'. I'm not sure when this happened, we are on 5.11.

The presentation of the output is

Billing Name and Address
<blank>
<billing address. 

The form has billing_first_name and billing_last_name.

enter image description here

The template web/sites/all/modules/civicrm/xml/templates/message_templates/contribution_online_receipt_html.tpl

has

{elseif $amount GT 0}
   <tr>
    <th {$headerStyle}>
     {ts}Billing Name and Address{/ts}
    </th>
   </tr>
   <tr>
    <td colspan="2" {$valueStyle}>
     {$billingName}<br />
     {$address|nl2br}<br />
     {$email}
    </td>
   </tr>
  {/if}
  • That file location isn't where the actual message template that gets used is stored. You want to check Admin - CiviMail - Message Templates, then click on the System Workflow tab there and look at the contribution receipt one. – Demerit Mar 29 at 22:20
4

The answer posted by Interlated can be problematic and display incorrect name if the contact doing the contribution has different name specific for billing fields. For Eg -

  • A contribution page is created with profile = "Name and Address".
  • When the page is visited online, the profile + billing profile is loaded on the form.
  • User unchecks the option My billing address is the same as above and enters a different name and address for billing fields.

The {contact.display_name} will load the original contact name in the mail receipt instead of the expected billing name.

We've also come across this problem and saw some receipt missing the billing fields. This seems to be due to name field in civicrm_address table being set to NULL due to some reason.

Not yet sure how to replicate this, but below patch have fixed the problem for us.

diff --git a/CRM/Core/BAO/Address.php b/CRM/Core/BAO/Address.php
index af3dbd233d..31f69c9996 100644
--- a/CRM/Core/BAO/Address.php
+++ b/CRM/Core/BAO/Address.php
@@ -504,6 +504,10 @@ class CRM_Core_BAO_Address extends CRM_Core_DAO_Address {
       $values = [];
       CRM_Core_DAO::storeValues($address, $values);

+      //Fill name of contact if empty.
+      if (empty($address->name) && !empty($address->contact_id)) {
+        $address->name = CRM_Contact_BAO_Contact::displayName($address->contact_id);
+      }
       // add state and country information: CRM-369
       if (!empty($address->location_type_id)) {
         $values['location_type'] = CRM_Utils_Array::value($address->location_type_id, $locationTypes);
  • Is this going to be a core patch eventually? – Zachary Sep 27 at 15:40
1

The solution was to change the token from

{$billingName}

to

{contact.display_name}

Following

  1. Administer > communications > message templates civicrm/admin/messageTemplates
  2. System workflow messages
  3. Memberships - Receipt (on-line). Change{$billingName} to {contact.display_name} via the tokens picker

Run the membership test-run link.

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.