latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Address Fields

Home Forums Community Forum Address Fields

This topic contains 5 replies, has 2 voices. Last updated by  Raam Dev 4 years, 3 months ago.

Topic Author Topic
Posted: Wednesday Sep 26th, 2012 at 4:56 am #26531
Hamid
Username: zawiyaprojects

Hello Support,

I add initially set up my subscriber registration form with some custom fields (i.e. title, address, city, state and country).

I just created my first Paypal pro form and noticed there is already a “billing address” section on the pro form (along with my custom address fields), basically two “address” sections.

Is there a way to include the billing address fields of the pro form in the subscriber registration form (as non-required fields) instead of the custom address fields I created?

2nd Question: Does the billing fields entered in the pro forms get populated into a users profile?

The point of my questions is to figure out the best way to add the address fields to a member’s profile (without duplicate data when they upgrade to a paid membership).

I have read some other posts like “Auto-Populate Billing Address” but I didn’t quite follow it. Do you have to have custom address fields first then use it to populate the billing address fields or can you just use the billing address fields off the bat. Obviously confused.

All suggestions are most welcome. Thanks

List Of Topic Replies

Viewing 5 replies - 1 through 5 (of 5 total)
Author Replies
Author Replies
Posted: Thursday Sep 27th, 2012 at 4:46 am #26655
Raam Dev
Username: Raam
Staff Member

Is there a way to include the billing address fields of the pro form in the subscriber registration form (as non-required fields) instead of the custom address fields I created?

2nd Question: Does the billing fields entered in the pro forms get populated into a users profile?

The billing fields that you see on the Pro-Form are only used for processing the payment with the payment gateway. They are not stored on the users profile.

If you want to store billing information on the users profile, but you don’t want the user to see two sets of billing fields, then here’s what you need to do: You need to create a set of Custom Registration Fields for all the billing info that you want to collect, making sure that they are configured to show up during the registration process.

The next step is writing some JavaScript that automatically copies things from one field to another. So for the billing address field, your JavaScript would automatically copy whatever the user types into the Billing Address field to your Custom Profile Field called Billing Address. You would do the same for each of the billing fields that you want to save.

The last step is dealing with the problem of duplicate fields showing up. To fix that, you’ll just need to use some CSS to hide each of the fields (display:none;).

Now, when a user fills out his billing address in the Pro-Form, JavaScript will be quietly copying the data to the hidden fields. When the user clicks Submit Form, all those hidden Custom Registration Fields with the billing information in them are saved to the users profile.

To accomplish this customization, you’ll need to modify the Pro-Form templates. You can read more about modifying the Pro-Form templates here.

Posted: Thursday Sep 27th, 2012 at 6:43 am #26668
Hamid
Username: zawiyaprojects

Thanks Raam,

I’m working on it now. Will let you know what happens.

Posted: Sunday Sep 30th, 2012 at 4:45 am #27001
Hamid
Username: zawiyaprojects

Raam, I worked out the javascript part to fill out the billing and custom fields. But I will have to wait until the next major release of s2member as I currently have a Paypal Advanced account (not Pro).

Posted: Sunday Sep 30th, 2012 at 4:55 am #27002
Hamid
Username: zawiyaprojects

I have include the javascript part here for anyone else trying to do this. Please keep in mind it’s very generic at the moment and only a starting point (to proceed you will need to get the proper billing data field ids).

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
</head>
<body>

<h3>Billing Fields</h3>
  <div>Street Adress: <input type="text" id="billingStreet"/></div>
  <div>City/Town: <input type="text" id="billingCity"/></div>  
  <div>State/Province:<input type="text" id="billingState"/></div>
  <div>Country:<input type="text" id="billingCountry"/></div> 
  <div>Zip:<input type="text" id="billingZip"/></div>  
 
 
  
<h3>Custom Fields</h3>    
  <div>Custom Street Address:<input type="text" id="customStreet"/></div>
  <div>Custom City/Town:<input type="text" id="customCity"/></div>  
  <div>Custom State/Province:<input type="text" id="customState"/></div>  
  <div>Country:<input type="text" id="customCountry"/></div> 
  <div>Zip:<input type="text" id="customZip"/></div>  
  
  
<script>
  window.onload = function () {
  	var billingStreet = document.getElementById('billingStreet'),
    customStreet = document.getElementById('customStreet');

	var billingCity = document.getElementById('billingCity'),
	customCity = document.getElementById('customCity');
	
	var billingState = document.getElementById('billingState'),
	customState = document.getElementById('customState');

	var billingCountry = document.getElementById('billingCountry'),
	customCountry = document.getElementById('customCountry');
	
	var billingZip = document.getElementById('billingZip'),
	customZip = document.getElementById('customZip');	

	// can use either billingStreet.onkeyup or billingStreet.onchange 
  	billingStreet.onkeyup = function () { 
    customStreet.value = billingStreet.value;
    };

  	billingCity.onkeyup = function () { 
    customCity.value = billingCity.value;
    };    
 
  	billingState.onkeyup = function () { 
    customState.value = billingState.value;
    };  

  	billingCountry.onkeyup = function () { 
    customCountry.value = billingCountry.value;
    };    
 
  	billingZip.onkeyup = function () { 
    customZip.value = billingZip.value;
    }; 
    
};
</script>
</body>
</html>
Posted: Monday Oct 1st, 2012 at 5:50 am #27044
Raam Dev
Username: Raam
Staff Member

Thank you very much for sharing that, Hamid!

Awarded Hamid the Helpful badge.
Viewing 5 replies - 1 through 5 (of 5 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.