I am trying to create thank you letters grouping the transactions by contact. I am creating a table to display the contribution information but I am running into a problem with Transaction ID. since not every contribution has one, it doesn't align properly in the table. I tried using the 'line break' and 'verticle table cell' but the
or is not printing for when the token is empty.

I tried to work around it by printing N/A when if the token is empty but I can't seem to get this working either {capture assign=temp}{contribution.trxn_id}{/capture}{if $temp ne ""}{$temp}{else}N/A{/if}

enter image description here

UPDATE: I tried @RayWright's suggestion and it worked for individual thank you letters perfectly. However, when grouping the contribution records by contact, the same code will only print the transaction ID when there is one and will not print NA when there isn't one...

  • Any chance this post is helpful? civicrm.stackexchange.com/questions/21118/…
    – RayWright
    Commented Dec 22, 2017 at 16:07
  • Thanks @RayWright, that solved it for individual thank you letters however it still won't work for grouped-by-contact thank you letters
    – Yossi
    Commented Dec 22, 2017 at 22:01
  • @Yossi have you had a look at this related question/answer
    – Andrei
    Commented Dec 27, 2017 at 13:43
  • @Andrei Thank you for bringing that to my attention. It seems like the solution I am looking for but I have been trying for 1.5 hours to apply the same code for transaction id and I've not been successful yet. I don't know whether I am getting the variables wrong or if maybe the logic is different for trnx_id. Any ideas?
    – Yossi
    Commented Dec 28, 2017 at 2:48

1 Answer 1


This is a known bug and is documented and fixed at CRM-21690. You will need to apply the patch to fix the problem or will need to wait for 4.7.30 release.

  • I tested your patch on 4.7.25. It seems to fix the alignment of the transaction ID. However when I use the code snippet in CRM-21690, the thank you letter is not made and I get this error (even after I cleared templates_c) Parse error: syntax error, unexpected '&' in /srv/bindings/86e9cd092c1243e3a9ebfab3cf193a7e/files/private/civicrm/templates_c/en_US/%%63/634/6343E86A%%table%3E.php on line 36
    – Yossi
    Commented Jan 25, 2018 at 4:57
  • Can you please check the html message you using if it has any such chars. This error usually occurs if smarty fails to read the template or html. Commented Jan 25, 2018 at 5:21
  • you are right. The ckeditor transformed "" into its code version which included a &. Looks like the patch works!
    – Yossi
    Commented Jan 25, 2018 at 6:28
  • So can this question be closed as answered?? Commented Jan 25, 2018 at 10:51

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.