Jump to content

Can telephone number be made mandatory during checkout?


wiredworx

Recommended Posts

As the title says - does anyone know if there is a setting which makes the customer have to fill in at least one telephone number? I am having an issue as my dropshipper requires it but customers keep not filling it in! :)

Any help gratefully received.

Thanks
Rob.

Link to comment
Share on other sites

If you edit your classes/address.php file at the top is the following section of code.

    protected    $fieldsRequired = array('id_country', 'alias', 'lastname', 'firstname', 'address1', 'postcode', 'city', 'county');



change it to

    protected    $fieldsRequired = array('id_country', 'alias', 'lastname', 'firstname', 'address1', 'postcode',  'city', 'county', 'phone'); 



then in your theme folder edit the authentication.tpl file.

            

{l s='Home phone'}
               <input type="text" class="text" name="phone" id="phone" value="{if isset($smarty.post.phone)}{$smarty.post.phone}{/if}" />



change the above code to



{l s='Home phone'}
               <input type="text" class="text" name="phone" id="phone" value="{if isset($smarty.post.phone)}{$smarty.post.phone}{/if}" />
*



That will display the little astrix to show that it is required field.

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

Hey all,

Remember to change it in address.tpl in your theme directory also, as there is no asterix on there either:

Around line 87...

Change:



{l s='Home phone'}
           <input type="text" id="phone" name="phone" value="{if isset($smarty.post.phone)}{$smarty.post.phone}{else}{$address->phone|escape:'htmlall':'UTF-8'}{/if}" />



To:



{l s='Home phone'}
           <input type="text" id="phone" name="phone" value="{if isset($smarty.post.phone)}{$smarty.post.phone}{else}{$address->phone|escape:'htmlall':'UTF-8'}{/if}" />
*



Dan

Link to comment
Share on other sites

  • 2 months later...

Hi guys and girls

I have tried using the code above but for some reason I end up with this error message

"There is 1 error :

1. County is required"

however I have no filed called county on the sign up form

if any one has any ideas on a fix that would be fantastic

I'm using prestashop 1.2.5 and I have tried it on a clean install of prestashop as well just to check

Link to comment
Share on other sites

  • 3 months later...

Hi,
I tried that modification. Everything worked, Except:
If existing customer wants to update his profile and enters some data in the phone field, when saving he gets this error:
Hack attempt (Address -> phone is empty)

If nothing is entered in the phone field, so normal error message appears, that phone field has to be filled.

Can you advice what should I fix to make it work correctly?

Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...
  • 2 weeks later...
If you edit your classes/address.php file at the top is the following section of code.

protected $fieldsRequired = array('id_country', 'alias', 'lastname', 'firstname', 'address1', 'postcode', 'city', 'county');

change it to

protected $fieldsRequired = array('id_country', 'alias', 'lastn


Thanks, thought it was just me who couldn't find the instructions to force a telephone number entry! Works- thanks, JC
Link to comment
Share on other sites

  • 1 month later...

Hey man thanks so so much for that.

Am i right in assuming then if its not the HOME phone you want as compulsory but you want the MOBILE to be the one, then is it the code phone_mobile?

Also one thing :) this * works but on my theme the * is in the color Red, but when i put this on the phone one it is White :( how do i color this Red?


THanks

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...
Hey man thanks so so much for that.

Am i right in assuming then if its not the HOME phone you want as compulsory but you want the MOBILE to be the one, then is it the code phone_mobile?

Also one thing :) this * works but on my theme the * is in the color Red, but when i put this on the phone one it is White :( how do i color this Red?


THanks


I also having this problem. Does anyone know how to do the asterix red?
Link to comment
Share on other sites

  • 2 months later...

Hey!

Try to edit your classes/address.php from:


{l s='Home phone'}
               <input type="text" class="text" name="phone" id="phone" value="{if isset($smarty.post.phone)}{$smarty.post.phone}{/if}" />
*



to:


{l s='Home phone'}
               <input type="text" class="text" name="phone" id="phone" value="{if isset($smarty.post.phone)}{$smarty.post.phone}{/if}" />



and then edit your then in your theme folder edit the authentication.tpl file from:


{l s='Home phone'}
               <input type="text" class="text" name="phone" id="phone" value="{if isset($smarty.post.phone)}{$smarty.post.phone}{/if}" />
*
 



to:


{l s='Home phone'}
               <input type="text" class="text" name="phone" id="phone" value="{if isset($smarty.post.phone)}{$smarty.post.phone}{/if}" />
 






I have not tested yet, but I think it will work.

Regards,
J

Link to comment
Share on other sites

  • 4 weeks later...
Hey man thanks so so much for that.

Am i right in assuming then if its not the HOME phone you want as compulsory but you want the MOBILE to be the one, then is it the code phone_mobile?

Also one thing :) this * works but on my theme the * is in the color Red, but when i put this on the phone one it is White :( how do i color this Red?


THanks


I also having this problem. Does anyone know how to do the asterix red?


use "*" instead of "*"
Link to comment
Share on other sites

  • 4 months later...

Hi All,

I am on 1.2.5. I followed these steps to make Home Phone required on sign up.

Which works fine.

 

However if a customer trys to edit or add an address through their account or by my on the admin back office I see this error:

Hack attempt (Address -> phone is empty)

 

Can anyone help please as this is a major problem for me.

 

Thanks

Jaime

Link to comment
Share on other sites

I have done.

It seems that if i try to edit an address that was created before i made the amendment to the phone feild required it shows the error:

Hack attempt (Address -> phone is empty)

 

But if i try edit an address that was created after the amendment it works.

 

Any ideas?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...