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 Profiles (Moderator: Dave Greenberg) »
  • Allow user to enter name in the profile, and have it used for billing name
Pages: [1]

Author Topic: Allow user to enter name in the profile, and have it used for billing name  (Read 1512 times)

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Allow user to enter name in the profile, and have it used for billing name
October 18, 2009, 12:55:37 pm
I am using a profile that includes first and last name on a paid event sign up page. The payment processor is Pay Pal Pro.  ( the end-user can also choose to pay later. )  This results in the end-user having to type their first and last name twice: once for the profile, and again for the billing.

Is there way to make things easier for the end-user? And make sure I get their name for the event signup?

Thanks,
Sarah



Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

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: Allow user to enter name in the profile, and have it used for billing name
October 18, 2009, 02:37:24 pm

You  might want to consider using some jQuery javascript, so folks can copy their billing info to the profile values in one click (like most sites allow)

If you do so, please contribute the template changes back so others can reuse and benefit from 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

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Allow user to enter name in the profile, and have it used for billing name
October 18, 2009, 09:04:18 pm
I updated the template fiile:  CRM/Event/Form/Registration/Register.tpl

I added my code just after the line:    {if $paidEvent}

Are the field ids that I am looking for consistent across versions and installations?   The code below works in my environments ( 2.2.8 and 3.0.1)

<span id="askToDuplicate"> &nbsp; </span>

<script type="text/javascript" >
{literal}
function duplicateNameForBilling(form){

   if(document.getElementById("first_name")){ document.getElementById("billing_first_name").value = document.getElementById("first_name").value;  }
   if(document.getElementById("middle_name")){ document.getElementById("billing_middle_name").value = document.getElementById("middle_name").value; }
   if(document.getElementById("last_name")){ document.getElementById("billing_last_name").value = document.getElementById("last_name").value; }
 
   if(document.getElementById("street_address-1")){ document.getElementById("billing_street_address-5").value = document.getElementById("street_address-1").value; }
   if(document.getElementById("city-1")){ document.getElementById("billing_city-5").value = document.getElementById("city-1").value; }
   if(document.getElementById("state_province-1")){ document.getElementById("billing_state_province_id-5").value = document.getElementById("state_province-1").value; }
   if(document.getElementById("postal_code-1")){ document.getElementById("billing_postal_code-5").value = document.getElementById("postal_code-1").value; }
   if(document.getElementById("country-1")){ document.getElementById("billing_country_id-5").value = document.getElementById("country-1").value; }
}

if(document.getElementById("first_name")){
   document.getElementById("askToDuplicate").innerHTML = "<input type='radio' onClick='duplicateNameForBilling(form)' value='yes' name='Duplicate'>Fill in if above is also the billing name and address on the credit card";
}


{/literal}
</script>
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Allow user to enter name in the profile, and have it used for billing name
October 19, 2009, 05:03:36 pm
The field id's for the Billing block s/b consistent across installs (and I think across recent versions). However, the profile fields which have a location type (e.g. Street Address, City, etc.) will have different ideas depending on the location type in the profile. For example, "Street Address (home)" will be street_address-1, but "Street Address (primary)" is street_address-Primary.

I'd love to be able to include a solution for this (click to populate billing ...) - but haven't figured out a way to deal with the fact that we don't really know what profile fields have been included in the form.
Protect your investment in CiviCRM by  becoming a Member!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Allow user to enter name in the profile, and have it used for billing name

This forum was archived on 2017-11-26.