runtime123 Posted September 13, 2016 Share Posted September 13, 2016 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 More sharing options...
runtime123 Posted September 14, 2016 Author Share Posted September 14, 2016 (edited) Thank you Crezzur however now I get an error : An error occurred while creating your account. If I fill in the first name and last name fields, then the error goes away and it allows me to proceed? Edited September 14, 2016 by runtime123 (see edit history) Link to comment Share on other sites More sharing options...
runtime123 Posted September 14, 2016 Author Share Posted September 14, 2016 No - I will enable it now. I tested it again and I get this error: The Zip/Postal code you've entered is invalid. It must follow this format: 0000 Link to comment Share on other sites More sharing options...
runtime123 Posted September 14, 2016 Author Share Posted September 14, 2016 thank you Jaimy - is there a way to disable that so that you don't need to fill it in at all ? Link to comment Share on other sites More sharing options...
runtime123 Posted September 14, 2016 Author Share Posted September 14, 2016 (edited) 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 September 14, 2016 by runtime123 (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now