zapmore Posted August 25, 2013 Share Posted August 25, 2013 Hello! I have attached a image of my guest checkout and as you can see, there is 2 fields for the customers name. I want to delete or hide the top one and also move the email address to a more logical place. How can I accomplish this? I tried to delete the lower name fields in "localization->countries->fields" but then the system complains "please fill in your first name and last name". Who can help me with this? Link to comment Share on other sites More sharing options...
vekia Posted August 25, 2013 Share Posted August 25, 2013 you use default guest / one page checkout feature? it looks like some external solution, Am I right? Link to comment Share on other sites More sharing options...
zapmore Posted August 25, 2013 Author Share Posted August 25, 2013 Yes, its default guest checkout in the default prestashop theme, just styled it differently and added "display:none" in css on some element not in use. Link to comment Share on other sites More sharing options...
vekia Posted August 25, 2013 Share Posted August 25, 2013 you can define address format under the localization > countries tab near the active country click edit button, then you will be able to define which fields you want to display Link to comment Share on other sites More sharing options...
zapmore Posted August 25, 2013 Author Share Posted August 25, 2013 you can define address format under the localization > countries tab near the active country click edit button, then you will be able to define which fields you want to display This is what I did, but if I take away "first name" and "last name", the buyer can't continue because prestashop gives error message that there need to be a first and last name... This is why I thought it would be better and easier to take away the first and last name in the first section instead. Link to comment Share on other sites More sharing options...
vekia Posted August 25, 2013 Share Posted August 25, 2013 in this case go to the classes/Customer.php and remove required => true from object definition: 'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32), 'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32), do the same in classes/Address.php 1 Link to comment Share on other sites More sharing options...
trevorgilligan Posted June 16, 2015 Share Posted June 16, 2015 thanks @vekia Link to comment Share on other sites More sharing options...
CrossY Posted October 20, 2015 Share Posted October 20, 2015 (edited) in this case go to the classes/Customer.php and remove required => true from object definition: 'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32), 'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32), do the same in classes/Address.php I believe this removes the fields actually being created as well? I would like for both 'first name' and 'last name' to appear only once on my checkout. I have the following setup: Email Password (no guest checkout option) First name Last name First name Last name Address Etc. I would like for the account AND default address that the system uses only 1 field for this in the checkout, currently this is double. order-opc-new-account.tpl currently looks like this: <p class="required text"> <label for="firstname">{l s='First name'} <sup>*</sup></label> <input type="text" class="text" id="customer_firstname" name="customer_firstname" onblur="$('#firstname').val($(this).val());" value="{if isset($guestInformations) && $guestInformations.customer_firstname}{$guestInformations.customer_firstname}{/if}" /></p> <p class="required text"> <label for="lastname">{l s='Last name'} <sup>*</sup></label> <input type="text" class="text" id="customer_lastname" name="customer_lastname" onblur="$('#lastname').val($(this).val());" value="{if isset($guestInformations) && $guestInformations.customer_lastname}{$guestInformations.customer_lastname}{/if}" /></p> {elseif $field_name eq "firstname"} <p class="required text"> <label for="firstname">{l s='First name'} <sup>*</sup></label> <input type="text" class="text" id="firstname" name="firstname" value="{if isset($guestInformations) && $guestInformations.firstname}{$guestInformations.firstname}{/if}" /></p> {elseif $field_name eq "lastname"} <p class="required text"> <label for="lastname">{l s='Last name'} <sup>*</sup></label> <input type="text" class="text" id="lastname" name="lastname" value="{if isset($guestInformations) && $guestInformations.lastname}{$guestInformations.lastname}{/if}" /></p> I tried adding the 'value' fields to the other ones, but one gave me an error and the other did create the order, but then the accounts first/last name was 'Undefined'. Edited October 20, 2015 by CrossY (see edit history) Link to comment Share on other sites More sharing options...
CrossY Posted October 20, 2015 Share Posted October 20, 2015 I think I solved this by adding a type=hidden to the address creation: <p class="required text"> <label for="firstname">{l s='First name'} <sup>*</sup></label> <input type="text" class="text" id="customer_firstname" name="customer_firstname" onblur="$('#firstname').val($(this).val());" value="{if isset($guestInformations) && $guestInformations.customer_firstname}{$guestInformations.customer_firstname}{/if}" /> <input type="hidden" class="text" id="firstname" name="firstname" value="{if isset($guestInformations) && $guestInformations.firstname}{$guestInformations.firstname}{/if}" /></p> <p class="required text"> <label for="lastname">{l s='Last name'} <sup>*</sup></label> <input type="text" class="text" id="customer_lastname" name="customer_lastname" onblur="$('#lastname').val($(this).val());" value="{if isset($guestInformations) && $guestInformations.customer_lastname}{$guestInformations.customer_lastname}{/if}" /> <input type="hidden" class="text" id="lastname" name="lastname" value="{if isset($guestInformations) && $guestInformations.lastname}{$guestInformations.lastname}{/if}" /></p> 1 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