Jump to content

Guest Checkout Phone number error


Recommended Posts

Hi all,

 

My guest checkout has suddenly become unusable.  When completing the form there is an error saying that a phone number is required.  The only field available to fill is Mobile Phone.  Even if there is a number in mobile phone it throws the same error, "Phone number required".  Phone Number is Mandatory is turned to off in the BO.  It also shows Null in the DB.  I've replaced authentication.tpl, address.tpl and addresses.tpl with fresh pages with no results.  I found the following closed thread:

 

https://www.prestashop.com/forums/topic/322195-guess-checkout-mobile-phone-field-required-get-error-phone-is-required/

 

Please, does anyone have an idea on what could be going on here!?

 

On a side note, I also have a zip code error, although it doesn't affect the sign up.  It just shows red when entered.  I also removed any zip code validation from Localization > Countries.  I don't know if these are related.  Here is the thread for that issue:

 

https://www.prestashop.com/forums/topic/465629-postal-code-error-after-updating-to-1611/

 

PS 1.6.1.0

United States

Link to comment
Share on other sites

  • 4 months later...

you can always fix the phone field

 

themes/yourtheme/order-opc-new-account.tpl
line 250 in default-bootstrap for 1.6.1.4

<div class="form-group is_customer_param">

 

 

is_customer_param is the problem... if it is removed then guest checkout is fixed showing both phone fields
 
Then your validation will work.  If you dont have an override then perhaps someone altered /classes/Address.php and set phone to required in the definitions... In any case now this is fixed because the guest checkout has the phone field too.
 
The above fix is for 1 page checkout.
  • Like 1
Link to comment
Share on other sites

for standard 5 step GUEST checkout, you can add the field in 


themes/yourtheme/Authentication.tpl


 


insert this at line 272


<p class="form-group">


<label for="phone">{l s='Home phone'}{if isset($one_phone_at_least) && $one_phone_at_least} <sup>*</sup>{/if}</label>

<input type="text" class="form-control" name="phone" id="phone" value="{if isset($smarty.post.phone)}{$smarty.post.phone}{/if}" />

</p>

 

(just before mobile phone)

Link to comment
Share on other sites

for forced require validation... 


 


classes/address.php


 


definitions array... you can add or remove required => true


 


example:


 


            'phone' =>                array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'required' => true, 'size' => 32),

            'phone_mobile' =>        array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32),

 

 

here i force home phone, but dont care about cell.  This satisfies the setting at least 1 phone number required as well.

Link to comment
Share on other sites

 

you can always fix the phone field

 

themes/yourtheme/order-opc-new-account.tpl
line 250 in default-bootstrap for 1.6.1.4

<div class="form-group is_customer_param">

 

 

is_customer_param is the problem... if it is removed then guest checkout is fixed showing both phone fields
 
Then your validation will work.  If you dont have an override then perhaps someone altered /classes/Address.php and set phone to required in the definitions... In any case now this is fixed because the guest checkout has the phone field too.
 
The above fix is for 1 page checkout.

 

 

Thanks, I solved my old problem.

 

I removed is_customer_param from order-opc-new-account.tpl, but I added class hidden instead, because I just want to hide the input I don't use.

I also removed 'required'=>true from definition in Address class, from both phones, because I don't want this to be obligatory.

 

Before that fix I had whole div containing first phone removed from both occurences in order-opc-new-account.tpl. It was okay, but when customer got to guest checkout, left for some more shopping and came back to guest checkout, there was an error about phone being invalid.

Now the error is gone, but field for first phone is invisible anyway ;)

 

I remember the solution consisting of removing unused phone from definition array in Address class, but I wouldn't recommend it. I'm not sure about security of this, and this is core manipulation.

Link to comment
Share on other sites

  • 9 months later...

Hi,

 

does the fix below work for step   2 - Sign in   for a guest checkout or just step 3 Address 

 

you can always fix the phone field

 

themes/yourtheme/order-opc-new-account.tpl
line 250 in default-bootstrap for 1.6.1.4

<div class="form-group is_customer_param">
Link to comment
Share on other sites

If your are trying to fix this error in the 5 step checkout for a guest checkout, as discussed in the post above - Posted 02 February 2016 - 10:52 AM, not only will you have to add those lines (just before mobile phone). you will also have to add the following

 

{if isset($one_phone_at_least) && $one_phone_at_least}

    {assign var="atLeastOneExists" value=true}
    <p class="inline-infos required">** {l s='You must register at least one phone number.'}</p>
{/if} 
      
      (just after mobile phone)
 
 
Hope this Helps.
Link to comment
Share on other sites

×
×
  • Create New...