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) »
  • Display phone number on Confirm.tpl
Pages: [1]

Author Topic: Display phone number on Confirm.tpl  (Read 1692 times)

rs3515

  • I’m new here
  • *
  • Posts: 29
  • Karma: 1
Display phone number on Confirm.tpl
May 04, 2008, 04:10:19 pm
We have added
Code: [Select]
$form->_fields["billing_phone-{$bltID}"] to the Payment/Form.php file so we can display a "Phone Number" input field on our Main.tpl template page.  In the Main.tpl page we have added the following code and it works just fine:

Code: [Select]
<div class="formrow">
{assign var=n value=billing_phone-$bltID}
<label for="{$n}">Phone Number <span class="marker" title="This field is required.">*</span></label> {$form.$n.html}
</div>

I would think this should be really straightforward, but I'm having a hard time figuring out how to display the form value for phone on our Confirm.tpl template page.  I see on the Confirm.tpl page {$address|nl2br}, {$email}, {$credit_card_type}, etc.  So I tried {$billing_phone}, {$billing_phone-5}, {$form.billing_phone.value}, and none of them seemed to work.

What should I use?  Also is there a quick and easy way to print the entire form array on the page for debugging, such as
Code: [Select]
{php} print_r($form); {/php}?

rs3515

  • I’m new here
  • *
  • Posts: 29
  • Karma: 1
Re: Display phone number on Confirm.tpl
May 05, 2008, 02:16:27 am
With some further investigation I'm even more confused as to why this is not working.  Rather than adding billing phone to the Form.php file, I tried a more out-of-the-box approach of creating an extra CiviCRM profile field referencing Billing Phone Primary (phone-Primary-Phone), and the profile was applied to the CiviContribute page.

I then went to the Main contribution page and entered "111-111-1111" as a phone number.  When I go to the Confirm page and add &smartyDebug=1, I get the full list which shows {$form}.  Within the {$form} array I have a value of "111-111-1111" for phone-Primary-Phone, as I would have expected.  If I enter {$form.phone-Primary-Phone.value} in the Confirm.tpl page to display the result, the Confirm page displays "0".

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: Display phone number on Confirm.tpl
May 06, 2008, 04:21:29 am

not sure why the below is happening. can u try to reproduce on demo, if so gives us a better chance to track it down and fix it

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

rs3515

  • I’m new here
  • *
  • Posts: 29
  • Karma: 1
Re: Display phone number on Confirm.tpl
May 06, 2008, 07:19:40 am
I figured it out but it really makes no sense.  I was able to directly display custom data fields, but any fields tied to CiviCRM in the same array require an assign.  For example:

  • Custom field -- {$form.custom_14.value} prints a result
  • CiviCRM "custom" field -- {$form.phone-Primary.value} does not print a result, but the following does:

Code: [Select]
{assign var=n value=phone-Primary}
{$form.$n.value}

Makes no sense to me why it works this way since both custom_14 and phone-Primary are in the $form array.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Display phone number on Confirm.tpl

This forum was archived on 2017-11-26.