DARKF3D3 Posted February 13, 2020 Share Posted February 13, 2020 Hello, do you know if there's a way to remove those 2 fields. I want to ask for firstname and last name only ok address section of checkout and not before. I'm using Prestashop 1.7.4 Link to comment Share on other sites More sharing options...
SnapChatScore Posted February 18, 2020 Share Posted February 18, 2020 I want to do the same thing. Link to comment Share on other sites More sharing options...
El Patron Posted February 18, 2020 Share Posted February 18, 2020 this is not a native feature and would require custom code by competent developer as this is core data Link to comment Share on other sites More sharing options...
SnapChatScore Posted February 18, 2020 Share Posted February 18, 2020 Just now, El Patron said: this is not a native feature and would require custom code by competent developer as this is core data Okay in what file would we have to look to change things? Link to comment Share on other sites More sharing options...
El Patron Posted February 18, 2020 Share Posted February 18, 2020 33 minutes ago, SnapChatScore said: Okay in what file would we have to look to change things? if you cannot find the code changes yourself, you should not be making the changes, and for this you open pandora's box of changes...it's core, get someone competent that did not mean you lol Link to comment Share on other sites More sharing options...
SnapChatScore Posted February 18, 2020 Share Posted February 18, 2020 14 minutes ago, El Patron said: if you cannot find the code changes yourself, you should not be making the changes, and for this you open pandora's box of changes...it's core, get someone competent that did not mean you lol We are asking here for some one to help us with the changes, I just need to know where to look because as you can see I am new to Prestashop. Link to comment Share on other sites More sharing options...
El Patron Posted February 18, 2020 Share Posted February 18, 2020 can you first describe why the requirement for this change, this is a very one off requirement so what know why you want to implement this is a good starting point. Link to comment Share on other sites More sharing options...
SnapChatScore Posted February 19, 2020 Share Posted February 19, 2020 8 hours ago, El Patron said: can you first describe why the requirement for this change, this is a very one off requirement so what know why you want to implement this is a good starting point. I'm in indonesia which most of the people DO NOT have last name, so it will be confusing for most people to fill out a form which they don't have. 1 Link to comment Share on other sites More sharing options...
El Patron Posted February 19, 2020 Share Posted February 19, 2020 11 hours ago, SnapChatScore said: I'm in indonesia which most of the people DO NOT have last name, so it will be confusing for most people to fill out a form which they don't have. for 1.7: localization-->locations-->countries-->edit country there you can set the required fields for customer and address hope that helps Link to comment Share on other sites More sharing options...
DARKF3D3 Posted February 19, 2020 Author Share Posted February 19, 2020 (edited) I checked on that page, there I'm able to remove those 2 fields, the problem it's that they will be removed from address. I need to disable them from registration step only, then on address step the customer should fill these 2 fields. Edited February 19, 2020 by DARKF3D3 (see edit history) Link to comment Share on other sites More sharing options...
SnapChatScore Posted February 26, 2020 Share Posted February 26, 2020 On 2/19/2020 at 9:06 PM, DARKF3D3 said: I checked on that page, there I'm able to remove those 2 fields, the problem it's that they will be removed from address. I need to disable them from registration step only, then on address step the customer should fill these 2 fields. Same here Link to comment Share on other sites More sharing options...
grsinternet Posted September 29, 2020 Share Posted September 29, 2020 Things to do, to remove lastfield: 1. Select your country via Back-office (International>Locations>Countries) and remove "lastname": 2. Change required to non-required fields in these files: /app/classes/Address.php /app/classes/Customer.php From: 'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 255), To 'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'size' => 255), // custom changed 3. Remove Javascript Check: /app/classes/form/CustomerFormatter.php $format['lastname'] = (new FormField()) ->setName('lastname') ->setLabel( $this->translator->trans( 'Last name', [], 'Shop.Forms.Labels' ) ) ->setRequired(false); // set to false 4. Remove field: /app/themes/your_theme/templates/_partials/form-fields.tpl Add condition: <!-- Hide lastname field, add this condition before --> {if $field.name!='lastname'} <div class="form-group row {if !empty($field.errors)}has-error{/if}"> <label class="col-md-3 form-control-label{if $field.required} required{/if}"> {if $field.type !== 'checkbox'} {$field.label} {/if} </label> <div class="col-md-6{if ($field.type === 'radio-buttons')} form-control-valign{/if}"> <...> {/if} 1 Link to comment Share on other sites More sharing options...
fraizor Posted December 19, 2020 Share Posted December 19, 2020 On 9/29/2020 at 3:23 PM, grsinternet said: Things to do, to remove lastfield: 1. Select your country via Back-office (International>Locations>Countries) and remove "lastname": 2. Change required to non-required fields in these files: /app/classes/Address.php /app/classes/Customer.php From: 'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 255), To 'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'size' => 255), // custom changed 3. Remove Javascript Check: /app/classes/form/CustomerFormatter.php $format['lastname'] = (new FormField()) ->setName('lastname') ->setLabel( $this->translator->trans( 'Last name', [], 'Shop.Forms.Labels' ) ) ->setRequired(false); // set to false 4. Remove field: /app/themes/your_theme/templates/_partials/form-fields.tpl Add condition: <!-- Hide lastname field, add this condition before --> {if $field.name!='lastname'} <div class="form-group row {if !empty($field.errors)}has-error{/if}"> <label class="col-md-3 form-control-label{if $field.required} required{/if}"> {if $field.type !== 'checkbox'} {$field.label} {/if} </label> <div class="col-md-6{if ($field.type === 'radio-buttons')} form-control-valign{/if}"> <...> {/if} after doing these steps, customers are stuck at address step in checkout 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