Jump to content

Delete double name input in checkout


zapmore

Recommended Posts

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?

 

2s6kdj4.jpg

Link to comment
Share on other sites

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

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

  • Like 1
Link to comment
Share on other sites

  • 1 year later...
  • 4 months later...

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 by CrossY (see edit history)
Link to comment
Share on other sites

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>
  • Like 1
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...