telnett Posted March 2, 2017 Share Posted March 2, 2017 I need to add/remove some fields in the address form, what would be the best approach? Is there a hook that I could make use of for this matter? Link to comment Share on other sites More sharing options...
rocky Posted March 4, 2017 Share Posted March 4, 2017 Can you be more specific about what you're trying to remove? If it's simply the phone numbers, you can go to Preferences > Customers and change "Phone number is mandatory" to "No" and then remove the phone number fields from the theme's TPL files. You can also go to Localization > Countries to change the address format for a country. That will also change the fields and order when entering addresses. Note that some fields are required, so they can't be removed. If you need to do more than that, you'll need to use overrides, since there are no hooks to change address fields. Link to comment Share on other sites More sharing options...
telnett Posted March 4, 2017 Author Share Posted March 4, 2017 Hello and thank you for your response! I could not find a good way to achieve this so I just edited address-form.tpl, but I was trying to avoid that method so I asked here. {if $field['name']|strstr:"id_country"} {continue} {/if} {if $field['name']|strstr:"address2"} {continue} {/if} {if $field['name']|strstr:"vat_number"} {continue} {/if} {if $field['name']|strstr:"company"} {continue} {/if} I understand using overrides would be right way to do this but I'm not familiar with overrides. Is there any basic tutorial for that? Also, additional notes field is removed from the order procedure in 1.7 so I will need to find a way to put that in. Link to comment Share on other sites More sharing options...
rocky Posted March 4, 2017 Share Posted March 4, 2017 Interesting solution. Thanks for sharing. You can learn more about overriding in the PrestaShop documentation here. Link to comment Share on other sites More sharing options...
markoroots Posted December 11, 2017 Share Posted December 11, 2017 You have to go to shop paramenters - Contact - Shops there you will found where those informations are stored. Link to comment Share on other sites More sharing options...
markoroots Posted December 11, 2017 Share Posted December 11, 2017 You can simply delete the field you want exclude. But if you need to hide some address informations only in some place and not in all then you have to modify only the file interested. Link to comment Share on other sites More sharing options...
spiralciric Posted May 20, 2018 Share Posted May 20, 2018 It is not there marko. Its in International->locations->chosen country 1 Link to comment Share on other sites More sharing options...
romerson Posted March 27, 2019 Share Posted March 27, 2019 On 3/2/2017 at 2:46 PM, telnett said: I need to add/remove some fields in the address form, what would be the best approach? Is there a hook that I could make use of for this matter? I think the easiast way in prestashop 1.7.5 is to edit your country in International -> zone géographique -> pays You can do approximately all you want there. Thank you Prestashop. 3 Link to comment Share on other sites More sharing options...
difisi Posted November 13, 2019 Share Posted November 13, 2019 On 3/27/2019 at 11:31 AM, romerson said: I think the easiast way in prestashop 1.7.5 is to edit your country in International -> zone géographique -> pays You can do approximately all you want there. Thank you Prestashop. THANK YOU !!!! 1 Link to comment Share on other sites More sharing options...
Winkli Posted November 18, 2019 Share Posted November 18, 2019 And how can I delete the "Alias" field which appears only on user account - add new address page? PS 1.7.4.2 Link to comment Share on other sites More sharing options...
diondlemarcu Posted March 31, 2020 Share Posted March 31, 2020 (edited) On 3/2/2017 at 2:46 PM, telnett said: I need to add/remove some Nox Vidmate VLC fields in the address form, what would be the best approach? Is there a hook that I could make use of for this matter? It is not there marko. Its in International->locations->chosen country Edited March 31, 2020 by diondlemarcu (see edit history) Link to comment Share on other sites More sharing options...
fercaldas Posted April 5, 2020 Share Posted April 5, 2020 I change the fields in Locations -> Chooes country -> Edit and now i get page error 500 in site, when i try to add the firts adress... Thats the correct way?? 1 Link to comment Share on other sites More sharing options...
Chill_user Posted April 6, 2020 Share Posted April 6, 2020 (edited) Creating function in your controller/module/class. It's dummy way to create it rawly, better to use ForMbuilder of prestashop. But anyway my code works: public function createAddressCustom(){ if (((bool)Tools::isSubmit('create_address_custom')) == true){ $user_address_surname = Tools::getValue('adress_surname'); $user_address_name = Tools::getValue('adress_name'); $user_address_address = Tools::getValue('adress_adress'); $user_address_complement = Tools::getValue('adress_complement'); $user_address_postcode = Tools::getValue('adress_postcode'); $user_address_city = Tools::getValue('adress_city'); $user_address_country = Tools::getValue('adress_country'); /*creating address*/ $address = new Address(null, $this->context->language->id); $address->lastname = trim(ucfirst($user_address_surname)); $address->firstname = trim(ucfirst($user_address_name)); $address->address1 = ucfirst($user_address_address); $address->address2 = ucfirst($user_address_complement); $address->postcode = trim($user_address_postcode); $address->city = ($user_address_city); $address->id_customer = (int) $this->context->customer->id; $address->id_country = (int)19; $address->id_state = 0; $address->alias = 'Mon adresse'; //dump($address); $address->save(); } } And .tpl file below <form> <div class="form-group"> <label for="exampleInputEmail1">Nom</label> <input type="text" class="form-control text-capitalize" id="" name="user_surname" placeholder=""> </div> <div class="form-group"> <label for="exampleInputEmail1">Prenom</label> <input type="text" class="form-control text-capitalize" id="" name="user_name" placeholder=""> </div> <div class="form-group"> <label for="exampleInputEmail1">Email address</label> <input type="email" class="form-control" id="" name="user_email" namearia-describedby="emailHelp" placeholder="Votre email"> <small id="emailHelp" class="form-text text-muted">Nous ne partagerons jamais votre e-mail avec quelqu'un d'autre</small> </div> <div class="form-group"> <label for="exampleInputPassword1">Password</label> <input type="password" class="form-control" id="" name="user_password" placeholder="Password"> </div> <div class="form-group"> <label for="exampleInputPassword1">Numero de telephone</label> <input type="number" class="form-control" id="" name="user_phone" placeholder="Example:0041761234567"> <small id="emailHelp" class="form-text text-muted"></small> </div> <div class="form-group"> <label for="exampleInputPassword1">Date de naissance</label> <input type="date" class="form-control" id="" name="user_birthdate" placeholder="jj/mm/aa"> <small id="emailHelp" class="form-text text-muted">Date de votre naissance</small> </div> <button type="submit" class="btn btn-primary" name="create_user_custom" value="Save">Submit</button> </form> Dont forget to add phone number to ps_customer table, because I link the phone not to adress but to customer. Also dont forget to link your tpl to the controller/module: return $this->display(__FILE__, 'views/templates/front/create_order.tpl'); //or path you desire P.S. just remember, you need to adapt the code to your needs, it's something as cheatsheet I wrote you and code was written to my needs. Edited April 6, 2020 by Amantha Bill (see edit history) 1 Link to comment Share on other sites More sharing options...
fercaldas Posted April 8, 2020 Share Posted April 8, 2020 On 4/6/2020 at 10:04 AM, Amantha Bill said: Creating function in your controller/module/class. It's dummy way to create it rawly, better to use ForMbuilder of prestashop. But anyway my code works: public function createAddressCustom(){ if (((bool)Tools::isSubmit('create_address_custom')) == true){ $user_address_surname = Tools::getValue('adress_surname'); $user_address_name = Tools::getValue('adress_name'); $user_address_address = Tools::getValue('adress_adress'); $user_address_complement = Tools::getValue('adress_complement'); $user_address_postcode = Tools::getValue('adress_postcode'); $user_address_city = Tools::getValue('adress_city'); $user_address_country = Tools::getValue('adress_country'); /*creating address*/ $address = new Address(null, $this->context->language->id); $address->lastname = trim(ucfirst($user_address_surname)); $address->firstname = trim(ucfirst($user_address_name)); $address->address1 = ucfirst($user_address_address); $address->address2 = ucfirst($user_address_complement); $address->postcode = trim($user_address_postcode); $address->city = ($user_address_city); $address->id_customer = (int) $this->context->customer->id; $address->id_country = (int)19; $address->id_state = 0; $address->alias = 'Mon adresse'; //dump($address); $address->save(); } } And .tpl file below <form> <div class="form-group"> <label for="exampleInputEmail1">Nom</label> <input type="text" class="form-control text-capitalize" id="" name="user_surname" placeholder=""> </div> <div class="form-group"> <label for="exampleInputEmail1">Prenom</label> <input type="text" class="form-control text-capitalize" id="" name="user_name" placeholder=""> </div> <div class="form-group"> <label for="exampleInputEmail1">Email address</label> <input type="email" class="form-control" id="" name="user_email" namearia-describedby="emailHelp" placeholder="Votre email"> <small id="emailHelp" class="form-text text-muted">Nous ne partagerons jamais votre e-mail avec quelqu'un d'autre</small> </div> <div class="form-group"> <label for="exampleInputPassword1">Password</label> <input type="password" class="form-control" id="" name="user_password" placeholder="Password"> </div> <div class="form-group"> <label for="exampleInputPassword1">Numero de telephone</label> <input type="number" class="form-control" id="" name="user_phone" placeholder="Example:0041761234567"> <small id="emailHelp" class="form-text text-muted"></small> </div> <div class="form-group"> <label for="exampleInputPassword1">Date de naissance</label> <input type="date" class="form-control" id="" name="user_birthdate" placeholder="jj/mm/aa"> <small id="emailHelp" class="form-text text-muted">Date de votre naissance</small> </div> <button type="submit" class="btn btn-primary" name="create_user_custom" value="Save">Submit</button> </form> Dont forget to add phone number to ps_customer table, because I link the phone not to adress but to customer. Also dont forget to link your tpl to the controller/module: return $this->display(__FILE__, 'views/templates/front/create_order.tpl'); //or path you desire P.S. just remember, you need to adapt the code to your needs, it's something as cheatsheet I wrote you and code was written to my needs. Sorry i'm a newbie... Could you specify what files we have to maintain exactly? Thx Link to comment Share on other sites More sharing options...
966972_1508426717 Posted December 22, 2022 Share Posted December 22, 2022 Hi I need the email to be there also - how to do so? Jan 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