Signup form with first & last name ?

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
sacards.com
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 28
Joined: Wed Jun 04, 2008 1:45 am

Signup form with first & last name ?

Post by sacards.com » Sat Aug 02, 2008 1:24 am

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,

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Signup form with first & last name ?

Post by mazhar » Sat Aug 02, 2008 5:23 am

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

industry
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 37
Joined: Fri Apr 03, 2009 4:17 am

Re: Signup form with first & last name ?

Post by industry » Wed Apr 15, 2009 4:29 am

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" :?

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Signup form with first & last name ?

Post by mazhar » Wed Apr 15, 2009 7:15 am

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
...
...

industry
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 37
Joined: Fri Apr 03, 2009 4:17 am

Re: Signup form with first & last name ?

Post by industry » Wed Apr 15, 2009 7:42 am

So simple :lol:

Thanks alot for your help, very much appreciated :D

User avatar
mfreeze
Commodore (COMO)
Commodore (COMO)
Posts: 421
Joined: Mon Jan 24, 2005 2:07 pm
Location: Washington, NJ
Contact:

Re: Signup form with first & last name ?

Post by mfreeze » Thu Jul 23, 2009 2:20 pm

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.
Mary E Freeze

Freeze Frame Graphics
Web Hosting and Design, ASP and CFMX Development

http://www.ffgraphics.com

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Signup form with first & last name ?

Post by mazhar » Fri Jul 24, 2009 3:56 am

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"; 

User avatar
mfreeze
Commodore (COMO)
Commodore (COMO)
Posts: 421
Joined: Mon Jan 24, 2005 2:07 pm
Location: Washington, NJ
Contact:

Re: Signup form with first & last name ?

Post by mfreeze » Fri Jul 24, 2009 8:50 am

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.
Mary E Freeze

Freeze Frame Graphics
Web Hosting and Design, ASP and CFMX Development

http://www.ffgraphics.com

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Signup form with first & last name ?

Post by mazhar » Fri Jul 24, 2009 8:57 am

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.

User avatar
mfreeze
Commodore (COMO)
Commodore (COMO)
Posts: 421
Joined: Mon Jan 24, 2005 2:07 pm
Location: Washington, NJ
Contact:

Re: Signup form with first & last name ?

Post by mfreeze » Fri Jul 24, 2009 11:02 am

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();
}
Mary E Freeze

Freeze Frame Graphics
Web Hosting and Design, ASP and CFMX Development

http://www.ffgraphics.com

User avatar
mfreeze
Commodore (COMO)
Commodore (COMO)
Posts: 421
Joined: Mon Jan 24, 2005 2:07 pm
Location: Washington, NJ
Contact:

Re: Signup form with first & last name ?

Post by mfreeze » Fri Jul 24, 2009 2:45 pm

I got it. The format is
emailTemplates[0].ToAddress = newUser.PrimaryAddress.Email;
.

Thanks for your assistance.
Mary E Freeze

Freeze Frame Graphics
Web Hosting and Design, ASP and CFMX Development

http://www.ffgraphics.com

Post Reply