toimata Posted May 21, 2021 Share Posted May 21, 2021 Hello, How can i remove "alias" field (wich is optional) on the front customer address form ? i can't find it on the location / country pay in backoffice page Thanks cheers, Link to comment Share on other sites More sharing options...
w3bsolutions Posted May 25, 2021 Share Posted May 25, 2021 As long as its the first field in the form (which it is, unless you specifically change it), you can just hide it via CSS: .address-form .form-group:first-of-type { display: none; } 1 Link to comment Share on other sites More sharing options...
toimata Posted May 27, 2021 Author Share Posted May 27, 2021 Hi, Thanks a lot for your answer. Isn't there a simple way to do it from backoffice ? Why this field is not visible in the country settings with other fields ? Link to comment Share on other sites More sharing options...
w3bsolutions Posted May 27, 2021 Share Posted May 27, 2021 You can do it from the back office installing this module to add custom CSS: https://www.sunnytoo.com/download/10901/ and then in the module configuration paste the code I gave you above. This is more of a technical field so the customer can give a name to each address in order to distinguish them better (for example "Home", "Work", etc), it is not address-related field, that is why it is not in the country configuration. Link to comment Share on other sites More sharing options...
toimata Posted May 27, 2021 Author Share Posted May 27, 2021 Thank you, is it a free plugin ? Is it possible to see a demo ? Link to comment Share on other sites More sharing options...
w3bsolutions Posted May 27, 2021 Share Posted May 27, 2021 Just now, toimata said: Thank you, is it a free plugin ? Is it possible to see a demo ? Yes it is free, that is the direct download link. Here is the module description: https://www.sunnytoo.com/10750/free-prestashop1-7-custom-code-module-put-custom-css-javascript-google-analytics-code-google-fonts-site-without-editing-files Link to comment Share on other sites More sharing options...
toimata Posted May 27, 2021 Author Share Posted May 27, 2021 Ok I see, actually i can edit css by myself, don't need a plugin for that. However, i believe Prestashop already has a way to remove this field wich is not mandatory. Where could i find this option ? 1 Link to comment Share on other sites More sharing options...
w3bsolutions Posted May 27, 2021 Share Posted May 27, 2021 There is no option... I have been working with Prestashop for 10+ years, you can believe me... Link to comment Share on other sites More sharing options...
toimata Posted May 27, 2021 Author Share Posted May 27, 2021 Ok, thanks a lot ! Link to comment Share on other sites More sharing options...
toimata Posted May 28, 2021 Author Share Posted May 28, 2021 I used my theme editor to add the css you sent but doesn't work. Even using !important; property Link to comment Share on other sites More sharing options...
w3bsolutions Posted May 28, 2021 Share Posted May 28, 2021 2 hours ago, toimata said: I used my theme editor to add the css you sent but doesn't work. Even using !important; property From what I see it did work... seems like you just have to clear your cache. I registered on your site and the field is gone on the form, hidden by the code I gave you Link to comment Share on other sites More sharing options...
toimata Posted May 28, 2021 Author Share Posted May 28, 2021 Yes i found it :-) i just renamed the classe addin "js-": .js-address-form .form-group:first-of-type { display: none!important; } Thanks a lot ! Link to comment Share on other sites More sharing options...
ConH Posted November 1, 2021 Share Posted November 1, 2021 (edited) On 5/26/2021 at 1:19 AM, w3bsolutions said: As long as its the first field in the form (which it is, unless you specifically change it), you can just hide it via CSS: .address-form .form-group:first-of-type { display: none; } Sorry to steal this topic, but I am after the same thing. I did install the CSS module like you suggested and added the code to the first "Custom CSS Code" field. Nothing seems to happen though. Also I would like to hide the company an VAT fields. How do I go about that? Found that one already, but: Equally the tickbox for "use this address for the invoice too" needs to go. Edited November 1, 2021 by ConH (see edit history) Link to comment Share on other sites More sharing options...
w3bsolutions Posted November 8, 2021 Share Posted November 8, 2021 On 11/1/2021 at 1:25 PM, ConH said: I did install the CSS module like you suggested and added the code to the first "Custom CSS Code" field. Nothing seems to happen though. Have you tried with the code suggested above by @toimata? .js-address-form .form-group:first-of-type { display: none!important; } 1 Link to comment Share on other sites More sharing options...
denincikas Posted June 9, 2022 Share Posted June 9, 2022 This didn't work for me so i used Js if someone needs it: Quote function hideAlias(){ var bodyId = document.body.id; var aliasField = document.getElementsByClassName("form-group row ")[0]; if(bodyId == "checkout"){ if(aliasField == undefined){ // do nothing } else{ aliasField.style.display = "none"; } } else{ // do nothing } } window.onload = hideAlias(); Just put it in custom.js Link to comment Share on other sites More sharing options...
bikoxe Posted July 12, 2022 Share Posted July 12, 2022 Bonjour J'ai le même problème mais sur PrestaShop 1.6.1.18. Existe-t-il aussi un module gratuit que je peux installer ? La version proposée m'indique à l'installation que le module n'est pas compatible avec ma version. Link to comment Share on other sites More sharing options...
Sachiya Posted August 6 Share Posted August 6 (edited) any one found a solution? Edited August 6 by Sachiya (see edit history) Link to comment Share on other sites More sharing options...
Mian Waqas Posted August 15 Share Posted August 15 Hello All, Read this topic and i want to add that the correct method to hide the "Alias" field is to remove this code from Public_html/classes/form/CustomerAddressForm.php this will hide it from the user to edit. (see attached image) Link to comment Share on other sites More sharing options...
Mediacom87 Posted August 15 Share Posted August 15 il y a une heure, Mian Waqas a dit : Hello All, Read this topic and i want to add that the correct method to hide the "Alias" field is to remove this code from Public_html/classes/form/CustomerAddressForm.php this will hide it from the user to edit. (see attached image) A radical solution that will fail at the slightest update. The CSS code solution is the safest and most durable. Link to comment Share on other sites More sharing options...
Mian Waqas Posted August 20 Share Posted August 20 (edited) On 8/15/2024 at 9:34 PM, Mediacom87 said: A radical solution that will fail at the slightest update. The CSS code solution is the safest and most durable. Yeah but you can further override it right? and the CSS method is old school for this, as anyone can change the display:none from developer tools on browser easily to show it? am i correct? if i am correct then why telling them to just simply hide this important box via CSS, if 1 change by 1 customer by unhiding it can ruin all there logic they want to make. why miss guide them at first place? so like i said its the proper way to do, which most of the people are looking for. Kind Regards Edited August 20 by Mian Waqas Typo (see edit history) Link to comment Share on other sites More sharing options...
Mediacom87 Posted August 20 Share Posted August 20 il y a 15 minutes, Mian Waqas a dit : it can ruin all there logic they want to make At the same time, we have no idea why he wants to implement this option. By using CSS, we can keep PrestaShop running without disturbing it or causing any side-effects. We can be sure that PrestaShop will continue to function properly. Link to comment Share on other sites More sharing options...
Mian Waqas Posted August 20 Share Posted August 20 5 minutes ago, Mediacom87 said: At the same time, we have no idea why he wants to implement this option. By using CSS, we can keep PrestaShop running without disturbing it or causing any side-effects. We can be sure that PrestaShop will continue to function properly. better find the side-effects of core changes. And similarly find the side-effects of CSS hiding. (for me i had already tested & had found none with core changes & dozens with css changes) and afterwards i had advised them with the correct method. Link to comment Share on other sites More sharing options...
Mediacom87 Posted August 20 Share Posted August 20 Il y a 2 heures, Mian Waqas a dit : better find the side-effects of core changes. And similarly find the side-effects of CSS hiding. (for me i had already tested & had found none with core changes & dozens with css changes) and afterwards i had advised them with the correct method. Thanks for these clarifications, although I don't know what side-effects there might be to simply hiding a native input field that won't impact any operation since nothing really changes. 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