Page 1 of 1
Signup form with first & last name ?
Posted: Sat Aug 02, 2008 1:24 am
by sacards.com
Is it possible to have the sign up form with first & last name ? currently it only needs email & password , however , i have so many customers with no names that i can't use good enough for marketing .
Regards,
Re: Signup form with first & last name ?
Posted: Sat Aug 02, 2008 5:23 am
by mazhar
Yes that will be an easy job. You just need to add two text boxes in the
ConLib/RegisterDialog.ascx and modify the
ConLib/RegisterDialog.ascx.cs file to include the code that will add the information from these newly added text boxes to the primary address of the user. This code could be something like below and place it just above the
following line in the
ConLib/RegisterDialog.ascx.cs file
//REDIRECT TO APPROPRIATE PAGE
so that it would be something like
Code: Select all
newUser.PrimaryAddress.FirstName = "Your First Name";
newUser.PrimaryAddress.LastName = "Your Last Name";
newUser.PrimaryAddress.Save();
//REDIRECT TO APPROPRIATE PAGE
...
...
Now you can replace the "Your First Name" and "Your Last Name" info with your newly added text boxes
Re: Signup form with first & last name ?
Posted: Wed Apr 15, 2009 4:29 am
by industry
mazhar wrote:Yes that will be an easy job. You just need to add two text boxes in the
ConLib/RegisterDialog.ascx and modify the
ConLib/RegisterDialog.ascx.cs file to include the code that will add the information from these newly added text boxes to the primary address of the user. This code could be something like below and place it just above the
following line in the
ConLib/RegisterDialog.ascx.cs file
//REDIRECT TO APPROPRIATE PAGE
so that it would be something like
Code: Select all
newUser.PrimaryAddress.FirstName = "Your First Name";
newUser.PrimaryAddress.LastName = "Your Last Name";
newUser.PrimaryAddress.Save();
//REDIRECT TO APPROPRIATE PAGE
...
...
Now you can replace the "Your First Name" and "Your Last Name" info with your newly added text boxes
This is exactly what i need too, thanks - although i'm being dumb in that when you say
"Now you can replace the "Your First Name" and "Your Last Name" info with your newly added text boxes" i dont know what i am supposed to add here?!
The page signs the user up but as i have a personalised greeting on my site it says "Welcome Your First Name"

Re: Signup form with first & last name ?
Posted: Wed Apr 15, 2009 7:15 am
by mazhar
In order to require this first name and last name information from user you will need to have two text boxes on signup form, for example if they are
Code: Select all
<asp:TextBox ID="FirstName" runat="server" />
<asp:TextBox ID="LastName" runat="server" />
Now the update C# code will be something like
Code: Select all
newUser.PrimaryAddress.FirstName = FirstName.Text;
newUser.PrimaryAddress.LastName = LastName.Text;
newUser.PrimaryAddress.Save();
//REDIRECT TO APPROPRIATE PAGE
...
...
Re: Signup form with first & last name ?
Posted: Wed Apr 15, 2009 7:42 am
by industry
So simple
Thanks alot for your help, very much appreciated

Re: Signup form with first & last name ?
Posted: Thu Jul 23, 2009 2:20 pm
by mfreeze
This code is great but I have one issue that I have been trying to figure out but have had no success thus far.
I have the following coded
EmailTemplateCollection emailTemplates = EmailTemplateDataSource.LoadForCriteria(" Name = 'Validate New User' ");
if (emailTemplates.Count > 0)
{
emailTemplates[0].Parameters.Add("username",newUser.PrimaryAddress.Email);
emailTemplates[0].Parameters.Add("password",Password.Text);
emailTemplates[0].Parameters.Add("firstname",newUser.PrimaryAddress.FirstName);
emailTemplates[0].Parameters.Add("lastname",newUser.PrimaryAddress.LastName);
emailTemplates[0].Parameters.Add("companyname",newUser.PrimaryAddress.Company);
emailTemplates[0].Parameters.Add("address1",newUser.PrimaryAddress.Address1);
emailTemplates[0].Parameters.Add("address2",newUser.PrimaryAddress.Address2);
emailTemplates[0].Parameters.Add("city",newUser.PrimaryAddress.City);
emailTemplates[0].Parameters.Add("state",newUser.PrimaryAddress.Province);
emailTemplates[0].Parameters.Add("zip",newUser.PrimaryAddress.PostalCode);
emailTemplates[0].Parameters.Add("phone",newUser.PrimaryAddress.Phone);
emailTemplates[0].Parameters.Add("license",LicenseNo.Text);
emailTemplates[0].Parameters.Add("licensest",LicenseSt.Text);
emailTemplates[0].Parameters.Add("licenseexp",LicenseExp.Text);
emailTemplates[0].Parameters.Add("taxid",TaxID.Text);
emailTemplates[0].Parameters.Add("existingcust",ExistingCust.SelectedItem.Value);
emailTemplates[0].Parameters.Add("custfunction",CustFunction.SelectedItem.Value);
emailTemplates[0].Send();
This works just fine when sending to a static email address that is filled out in the template. However, I need to send a copy to the person registering plus whatever addresses may be in the cc and bcc fields. How to I populate the email template 'to address' with the newUser.PrimaryAddress.Email?
I tried
template.ToAddress = template.ToAddress.Replace("vendor", String.Format("{0}", vendor.Email));
but this doesn't work because template.ToAddress is not available in my form. I know there should be another way but I haven't been able to figure it out.
I just tried emailTemplates[0].ToAddress = Token.Instance.User.Email; but the email still did not go to the customer.
Re: Signup form with first & last name ?
Posted: Fri Jul 24, 2009 3:56 am
by mazhar
Try following code
Code: Select all
//To address
template.ToAddress = newUser.PrimaryAddress.Email;
//CC List
template.CCList = "address1@yourdomain.com,address2@yourdomain.com";
//BCC List
template.BCCList = "address1@yourdomain.com,address2@yourdomain.com";
Re: Signup form with first & last name ?
Posted: Fri Jul 24, 2009 8:50 am
by mfreeze
I tried that and got \ConLib\Custom\NewRegisterDialog.ascx.cs(123): error CS0103: The name 'template' does not exist in the current context on the line in my code where I inserted it.
I have put emailTemplates[0].ToAddress = Token.Instance.User.Email just before the send but it seems to do nothing.
Re: Signup form with first & last name ?
Posted: Fri Jul 24, 2009 8:57 am
by mazhar
sorry I used template keyword instead of emailTemplates[0]. Any how go to merchant side edit your template and then remove if any thing you specified in To Address section and try again. Although I think even if there is something it should work but better give a try.
Re: Signup form with first & last name ?
Posted: Fri Jul 24, 2009 11:02 am
by mfreeze
It won't let me remove the To address so right now it specifies customer. I removed the cc addresses and now have the following code but no emails are being sent other than to the address that is hardcoded in the BCC field in the template.
//Send Email
EmailTemplateCollection emailTemplates = EmailTemplateDataSource.LoadForCriteria(" Name = 'Validate New User' ");
if (emailTemplates.Count > 0)
{
emailTemplates[0].Parameters.Add("username",newUser.PrimaryAddress.Email);
emailTemplates[0].Parameters.Add("password",Password.Text);
emailTemplates[0].Parameters.Add("firstname",newUser.PrimaryAddress.FirstName);
emailTemplates[0].Parameters.Add("lastname",newUser.PrimaryAddress.LastName);
emailTemplates[0].Parameters.Add("companyname",newUser.PrimaryAddress.Company);
emailTemplates[0].Parameters.Add("address1",newUser.PrimaryAddress.Address1);
emailTemplates[0].Parameters.Add("address2",newUser.PrimaryAddress.Address2);
emailTemplates[0].Parameters.Add("city",newUser.PrimaryAddress.City);
emailTemplates[0].Parameters.Add("state",newUser.PrimaryAddress.Province);
emailTemplates[0].Parameters.Add("zip",newUser.PrimaryAddress.PostalCode);
emailTemplates[0].Parameters.Add("phone",newUser.PrimaryAddress.Phone);
emailTemplates[0].Parameters.Add("license",LicenseNo.Text);
emailTemplates[0].Parameters.Add("licensest",LicenseSt.Text);
emailTemplates[0].Parameters.Add("licenseexp",LicenseExp.Text);
emailTemplates[0].Parameters.Add("taxid",TaxID.Text);
emailTemplates[0].Parameters.Add("existingcust",ExistingCust.SelectedItem.Value);
emailTemplates[0].Parameters.Add("custfunction",CustFunction.SelectedItem.Value);
emailTemplates[0].ToAddress = Token.Instance.User.Email;
emailTemplates[0].CCList = Token.Instance.User.Email;
emailTemplates[0].Send();
}
Re: Signup form with first & last name ?
Posted: Fri Jul 24, 2009 2:45 pm
by mfreeze
I got it. The format is
emailTemplates[0].ToAddress = newUser.PrimaryAddress.Email;
.
Thanks for your assistance.