Zen Cart Logo
Forums / General Questions / Making Telephone number a compulsory field

Making Telephone number a compulsory field

Views: 4,535

Results 1 to 20 of 21
8 Jun 2016, 5:12 PM
#1
aovc avatar

aovc

New Zenner

Join Date:
Mar 2012
Posts:
11
Plugin Contributions:
0

Making Telephone number a compulsory field

Our Couriers require a telephone number for each order.

How can we make the telephone number a required field for customers ?

8 Jun 2016, 5:35 PM
#2
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,798
Plugin Contributions:
22

Re: Making Telephone number a compulsory field

admin->configuration->minimum values->telephone number
Set it to at least 5 or 6. Keep in mind this will NOT affect returning customers who already created an account earlier - you'd need to add some custom code to require a phone number from existing customers when they log in or start checkout.

9 Jun 2016, 10:18 AM
#3
aovc avatar

aovc

New Zenner

Join Date:
Mar 2012
Posts:
11
Plugin Contributions:
0

Re: Making Telephone number a compulsory field

Thank you for your reply.

I went it and changed it to 6 but the value there was 3 so not sure why this did not prevent the customer from being able to place an order without a telephone number.

balihr:

admin->configuration->minimum values->telephone number
Set it to at least 5 or 6. Keep in mind this will NOT affect returning customers who already created an account earlier - you'd need to add some custom code to require a phone number from existing customers when they log in or start checkout.

9 Jun 2016, 11:48 AM
#4
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Making Telephone number a compulsory field

aovc:

Thank you for your reply.

I went it and changed it to 6 but the value there was 3 so not sure why this did not prevent the customer from being able to place an order without a telephone number.
As stated by balihr, the setting (whatever it may be or have been) will have no effect on existing customers. Based on the conversation one might assume that you are referring to orders placed by customers that have established an account after the time that a minimum value of 3 was established; however, the fact is not directly discussed yet.

The suggestion would be to review the affected order history against the customers. Identify when the customers established their account, then if the customers provided a phone number. Also to identify when the setting of 3 was established. From there can diagnose what the issue is and how to accomplish the desired modifications/actions.

31 Mar 2017, 12:14 AM
#5
ttfan avatar

ttfan

Zen Follower

Join Date:
Jul 2010
Location:
Australia
Posts:
231
Plugin Contributions:
0

Re: Making Telephone number a compulsory field

I have the same issue. The minimum number has always been set to 3, yet new customers register without a phone number. I'm using v1.5.5d.

Strangely in Configuration>Customer details there is no option to make phone numbers a requirement, while there is an option for almost every other field.

Did anyone resolve this issue?

31 Mar 2017, 12:10 PM
#6
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,100
Plugin Contributions:
56

Re: Making Telephone number a compulsory field

In what way is your store's /includes/modules/create_account.php (or the copy in /includes/modules/YOUR_TEMPLATE/create_account.php) different from the as-shipped version?

For that processing, if a customer enters a telephone-number of length less than the minimum-configured ... the account will not be created.

1 Apr 2017, 1:32 PM
#7
ttfan avatar

ttfan

Zen Follower

Join Date:
Jul 2010
Location:
Australia
Posts:
231
Plugin Contributions:
0

Re: Making Telephone number a compulsory field

lat9:

In what way is your store's /includes/modules/create_account.php (or the copy in /includes/modules/YOUR_TEMPLATE/create_account.php) different from the as-shipped version?

For that processing, if a customer enters a telephone-number of length less than the minimum-configured ... the account will not be created.
As far as I know, that file has no differences, yet we have a few new customers with no phone number in the field.

1 Apr 2017, 5:12 PM
#8
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,100
Plugin Contributions:
56

Re: Making Telephone number a compulsory field

Does your store accept payment via PayPal Express Checkout? If so, have the accounts that were created without phone numbers resulting from an express-checkout customer?

1 Apr 2017, 8:41 PM
#9
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Location:
Payson, AZ
Posts:
1,075
Plugin Contributions:
7

Re: Making Telephone number a compulsory field

ttfan:

As far as I know, that file has no differences, yet we have a few new customers with no phone number in the field.

did you check the user account phone number for blink spaces? 3 spaces equals 3 characters which creates the field as true when that is not a true phone number! The number is a string field and it's compared to a number by counting the characters like this (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) A set of 3 characters using (strlen) would = 3.

The fix is to use some script to mask the input, basically forcing the user to enter the correct information. The mask I use only allows numbers in the right order for the USA. But we still can't force them to truly enter there phone unless we use SMS and require a key entered to finish the account creation. a phone opt-in-opt-out set of code.

Google maskedinput

which is a jquery set of code.

I placed the code in the template tpl_create_account_default.php file at the bottom and used the class in the tpl_modules_create_account.php You code just use the ID tag if you like.

<script src="<?php echo $template->get_template_dir('jqueryui.js',DIR_WS_TEMPLATE, $current_page_base,'jscript') . '/jqueryui.js' ?>" type="text/javascript"></script>
<script src="<?php echo $template->get_template_dir('jquery.maskedinput.js',DIR_WS_TEMPLATE, $current_page_base,'jscript') . '/jquery.maskedinput.js' ?>" type="text/javascript"></script>
<script>
    $(function() {
        $("#date")
                .datepicker({ nextText: "", prevText: "", changeMonth: true, changeYear: true })
                .mask("99/99/9999");
    $(".phone")             .mask("999-999-9999");
    });
</script>

I also use it in the DOB field

2 Apr 2017, 4:14 AM
#10
ttfan avatar

ttfan

Zen Follower

Join Date:
Jul 2010
Location:
Australia
Posts:
231
Plugin Contributions:
0

Re: Making Telephone number a compulsory field

I've tested it myself, and it does not let you submit the page without entering characters in the phone field. Davewest must be right, they must be entering spaces, because the field is blank for some customers...the file must be removing these spaces before saving to the database because there are no spaces in the customer field when I check it.

2 Apr 2017, 7:31 AM
#11
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Making Telephone number a compulsory field

ttfan:

I've tested it myself, and it does not let you submit the page without entering characters in the phone field. Davewest must be right, they must be entering spaces, because the field is blank for some customers...the file must be removing these spaces before saving to the database because there are no spaces in the customer field when I check it.
Didn't answer the question previously asked regarding PayPal.

Also, while jquery, javascript, etc. Are good tools to give a good user experience, they can effectively be disabled. A check of the content of the submitted data would be necessary to further ensure at least some value was entered.

22 May 2018, 11:28 AM
#12
ttfan avatar

ttfan

Zen Follower

Join Date:
Jul 2010
Location:
Australia
Posts:
231
Plugin Contributions:
0

Re: Making Telephone number a compulsory field

lat9:

Does your store accept payment via PayPal Express Checkout? If so, have the accounts that were created without phone numbers resulting from an express-checkout customer?

I conpletely missed your comment.... yes you are absolutely right. I know now PayPal Express Checkout is what's causing the accounts without a phone numbers... not sure how to fix it though. Has anyone found a fix for this?

23 May 2018, 11:24 PM
#13
ttfan avatar

ttfan

Zen Follower

Join Date:
Jul 2010
Location:
Australia
Posts:
231
Plugin Contributions:
0

Re: Making Telephone number a compulsory field

I guess not?

12 Feb 2019, 3:12 AM
#14
shags38 avatar

shags38

Totally Zenned

Join Date:
Jan 2011
Location:
Adelaide, Australia
Posts:
1,684
Plugin Contributions:
0

Re: Making Telephone number a compulsory field

ttfan:

I guess not?

Because of a similar issue I deleted the 'checkout with PayPal' buttons on both the shopping cart page and checkout page which forces the customer use just the checkout button and then to either register an account or use guest checkout (with OPC - One Page Checkout - plugin installed) - guest checkout requires phone number as 'required' before guest is able to proceed - then they can elect to use PayPal as a payment method on the next page of the process. OPC does NOT register the customer as a 'customer' which may be a drawback for some for future marketing however this 'solution' would give the couriers the phone number they need.

Now thinking about it, it may be possible to link the checkout with PayPal button(s) to the Guest Checkout page (with OPC installed) - the customer then knows they are on track to use PayPal ??

Thoughts??

cheers,
Mike

9 Aug 2021, 9:27 AM
#15
clam_man avatar

clam_man

New Zenner

Join Date:
Jun 2019
Location:
Austin TX
Posts:
65
Plugin Contributions:
0

Re: Making Telephone number a compulsory field

I'm still having the same issue where changing the minimum value doesn't actually affect the form. I keep getting orders submitted without phone numbers but DHL requires a phone number. Is there not a simple solution for this?

9 Aug 2021, 11:18 AM
#16
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,100
Plugin Contributions:
56

Re: Making Telephone number a compulsory field

clam_man:

I'm still having the same issue where changing the minimum value doesn't actually affect the form. I keep getting orders submitted without phone numbers but DHL requires a phone number. Is there not a simple solution for this?
What payment method(s) are in use?

9 Aug 2021, 1:24 PM
#17
g2ktcf avatar

g2ktcf

Totally Zenned

Join Date:
Feb 2011
Location:
Lumberton, TX
Posts:
636
Plugin Contributions:
0

Re: Making Telephone number a compulsory field

clam_man:

I'm still having the same issue where changing the minimum value doesn't actually affect the form. I keep getting orders submitted without phone numbers but DHL requires a phone number. Is there not a simple solution for this?

I have seen other online store operators ask similar questions. The problem is, DHL my require a phone number but that does not stop your customer from entering gibberish or just a fake number. To me, that result is worse that no phone number at all. Suggestions on some other shipping sites are if a customer does not list a phone number for a shipment, you enter your number instead. At least if something goes wrong, you can rest assured that DHL has someone that they can contact.

9 Aug 2021, 6:05 PM
#18
clam_man avatar

clam_man

New Zenner

Join Date:
Jun 2019
Location:
Austin TX
Posts:
65
Plugin Contributions:
0

Re: Making Telephone number a compulsory field

We use authorize.net for credit cards and PayPal. The use of our number instead might work but I need to look into what negative effects that might cause with DHL.

9 Aug 2021, 6:31 PM
#19
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,100
Plugin Contributions:
56

Re: Making Telephone number a compulsory field

clam_man:

We use authorize.net for credit cards and PayPal. The use of our number instead might work but I need to look into what negative effects that might cause with DHL.
Are the missing telephone numbers associated with one, the other or both payment methods?

17 Jul 2022, 12:17 PM
#20
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Making Telephone number a compulsory field

Not sure if the OP resolved this, but we have similar issues, and ultimately, if a customer will not / cannot provide a valid phone number, there's nothing one can do about it. SO... in cases where DHL is the shipping, and we need a tel number, we put in OUR OWN telephone number... At least in that way, WE are advised by DHL of tracking and delivery, and (if necessary) can email the customer with details.
In many cases, people hate being spammed with text messages - and that's why they don't provide a number.
So what if DHL sends a text saying "your delivery is on it's way!"... I mean... that's what they DO isn't it? - deliver stuff...
If a customer DOES NOT get his stuff, you'll know (as DHL is communicating with YOU) and you can be sure the customer will call if they don't get the goods.
It's a non-issue in the real world...