Page 1 of 1

Require Phone Number

Posted: Tue Oct 08, 2013 4:51 pm
by kwikstand
How can I require a phone number for orders? I need it for shipping.

Thanks,

Scott

Re: Require Phone Number

Posted: Thu Oct 10, 2013 2:28 am
by mazhar
Edit Website/Checkout/ShipAddress.aspx and locate following code

Code: Select all

<asp:TextBox ID="Phone" runat="server" MaxLength="30" Width="100"></asp:TextBox>
and update it like

Code: Select all

<asp:TextBox ID="Phone" runat="server" MaxLength="30" Width="100"></asp:TextBox>
                                                    <span class="requiredField">*</span>
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" Text="*"
                                                        ErrorMessage="Phone number is required." Display="Static" ControlToValidate="Phone" ValidationGroup="AddrBook"></asp:RequiredFieldValidator>

Re: Require Phone Number

Posted: Thu Oct 10, 2013 7:10 am
by kwikstand
Thanks Mazhar, but my file doesn't contain that line of code. I am using AC Gold 7.0.8.5731

Re: Require Phone Number

Posted: Thu Oct 10, 2013 8:04 am
by Katie
It should be there. I just checked for build 5731. Make sure you're not looking in the wrong file. There is also a file named Shipaddresses.aspx. You need to be looking in Shipaddress.aspx

Re: Require Phone Number

Posted: Thu Oct 10, 2013 9:02 am
by kwikstand
Thanks Katie. You were right, I was looking at the wrong file. It works well now. The only things is, I tried to edit the Text to "Telephone for shipping" and the error message to "•Telephone number is required for shipping." and it doesn't change what is displayed.

I just want to let customers know why we need their phone number. I suspect the ones who don't enter it are concerned about giving out their phone numbers. When I try to find their number, it is usually unlisted.

Re: Require Phone Number

Posted: Thu Oct 10, 2013 9:22 am
by Katie
Hmm. Maybe it's cached? Have you tried to make a small change to the web.config file? This will recompile the application without having to access the server and restart IIS.

Re: Require Phone Number

Posted: Mon Oct 14, 2013 7:55 am
by kwikstand
Well, I implemented the phone # required field, and now I just had a customer order without a phone # again. So I guess it doesn't work.

Re: Require Phone Number

Posted: Mon Oct 14, 2013 3:05 pm
by Katie
Did you test this yourself? I just did, and it certainly looks like it's working. On the new shipping address page, this message appears "Phone number is required for shipping." I have to enter one to complete the form.

Is it possible that the customer you are talking about already had his shipping address stored?

Re: Require Phone Number

Posted: Mon Oct 14, 2013 3:58 pm
by kwikstand
Yes, I know. I checked it when I initiated the change, but I have since received an order that has no phone #. His purchase was made on 10/11/2013 and I made the phone # required on 10/10/2013. You can see the date on the forum post when I made the change. So I don't know how he made the purchase without a phone #.

Re: Require Phone Number

Posted: Mon Oct 14, 2013 5:00 pm
by Katie
Is it possible that the customer you are talking about already had his shipping address stored?

Re: Require Phone Number

Posted: Mon Oct 14, 2013 5:41 pm
by kwikstand
His account was registered at the time of sale.

Re: Require Phone Number

Posted: Tue Oct 15, 2013 4:31 am
by Katie
It's hard to say how this customer slipped through. If you have page tracking enabled, you can go to to his account profile and check to see which pages he viewed before and during checkout. If he happened to create an account and go directly to the Address Book page, then it would have been possible. This is the page I'm referring to: /Members/EditMyAddress.aspx

You might have to apply the code there too. Although, it would seem unlikely that someone would add shipping addresses before checking out, but I'm sure it's possible.

Re: Require Phone Number

Posted: Tue Oct 22, 2013 8:05 am
by kwikstand
I just had another sale with no phone #. I thought that maybe he edited his info after the sale. I checked the email notification (I have one sent to myself as well as the customer) and realized that the phone # is not included in the emails. How would I do that?

Thanks,

Scott

Re: Require Phone Number

Posted: Thu Oct 24, 2013 7:56 am
by jguengerich
You need to add a line of code to the /App_Data/EmailTemplates/1/CustomerOrderNotification.html file.

Find the following:

Code: Select all

<td class="Email" valign="top">
<strong>Ship To:</strong>
<div style="padding-left:30px;">
$shipment.FormatToAddress(true)
Right after that, add the line:

Code: Select all

<br />$shipment.ShipToPhone
I was going to suggest adding the format parameter to the FormatToAddress() method call, but I couldn't figure out how to get the line breaks passed correctly. If anyone else knows, I'm curious how to do it. This just puts the characters "\r\n" between each field:

Code: Select all

$shipment.FormatToAddress("[Company]\r\n[Name]\r\n[Address1]\r\n[Address2]\r\n[City_U], [Province_U] [PostalCode]\r\n[Country_U]\r\n[Phone]",true)
This results in blank lines if any of the fields are blank (I guess you could fix this by modifying the appropriate AddressFormatter.Format method if you have the source code):

Code: Select all

$shipment.FormatToAddress("[Company]<br/>[Name]<br/>[Address1]<br/>[Address2]<br/>[City_U], [Province_U] [PostalCode]<br/>[Country_U]<br/>[Phone]",true)
I think you can see what they entered by pulling up the order on the Admin side and going to the Addresses tab. The address info (including phone) appears to be saved with the shipment, so it should remain as originally entered, even if they later change the entry in their address book.

Re: Require Phone Number

Posted: Wed Oct 30, 2013 8:06 am
by kwikstand
I made the modifications and it works. Thanks for the help.

I am also wondering about customers that use Paypal to check out. They are taken directly to Paypal's site for payment. I don't know how that info gets back to my website.

Re: Require Phone Number

Posted: Thu Oct 31, 2013 11:08 am
by kwikstand
I just figured out that all of my orders without a phone # went through the Paypal Express checkout. That is what the problem is.