Jump to content

Recommended Posts

HI there

 

I am trying to change the "required" option on my one page checkout form fields in Presta Shop

 

I think I have found the file in which to do so?

 

"order-opc-new-account.tpl" - in my themes folder.    

 

_

I have removed the asterisk (*) from the field labels, "First Name" and "Last name" however the fields still remain as "required" - even with the (*) removed ?

 

Please can you assist me in changing the code so that these fields are NOT required. 

 

thank you

<div class="required form-group">
<label for="firstname">{l s='First name'} <sup></sup></label>
<input type="text" class="text form-control validate" id="customer_firstname" name="customer_firstname" onblur="$('#firstname').val($(this).val());" data-validate="isName" value="{if isset($guestInformations) && isset($guestInformations.customer_firstname) && $guestInformations.customer_firstname}{$guestInformations.customer_firstname}{/if}" />
</div>
<div class="required form-group">
<label for="lastname">{l s='Last name'} <sup></sup></label>
<input type="text" class="form-control validate" id="customer_lastname" name="customer_lastname" onblur="$('#lastname').val($(this).val());" data-validate="isName" value="{if isset($guestInformations) && isset($guestInformations.customer_lastname) && $guestInformations.customer_lastname}{$guestInformations.customer_lastname}{/if}" />
</div>

My client would like as few fields to be "required" as possible.   The fields still need to remain on the form, however they must not be "required"

Link to comment
Share on other sites

This is what is in Address.php (there is no required - true)

 'postcode' =>            array('type' => self::TYPE_STRING, 'validate' => 'isPostCode', 'size' => 12),

Is there something I can change in the "validate.php"

 

 /**
     * Check for zip code format validity
     *
     * @param string $zip_code zip code format to validate
     * @return bool Validity is ok or not
   
    public static function isZipCodeFormat($zip_code)
    {
        if (!empty($zip_code)) {
            return preg_match('/^[NLCnlc 0-9-]+$/', $zip_code);
        }
        return true;
    }
  
Edited by runtime123 (see edit history)
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...