vm0824 Posted April 12, 2017 Share Posted April 12, 2017 Hello, I am looking to learn a bit of development for my site. One small project, is I'd like for the phone number field to be mandatory in my address blocks. Here are the steps taken so far. I was able to look in the theme and find that checkout/_partials/address-form.tpl seems to be responsible for the the checkout portion. It extends customer/_partials/address-form.tpl. customer/_partials/address-form.tpl however does not seem to list out the fields here. Instead of iterates over a $formFields variable and then creates the fields from that. This is where I am stuck. Question: How do I find out where the $formFields variable is defined? And how can I edit it in a way that does not affect updates\upgrades and follows the best coding standards? Link to comment Share on other sites More sharing options...
bellini13 Posted April 12, 2017 Share Posted April 12, 2017 This used to be a configuration option, however it looks like yet another feature that Prestashop has removed. I thought maybe they moved the option to the Country settings (similar to the postal code and states), but not there either. Looks like you will need to research the following in classes\form CustomerAddressForm.php CustomerAddressFormatter.php CustomerAddressPersister.php Link to comment Share on other sites More sharing options...
Featured Comment Popular Post Vilius PromoApranga Posted April 12, 2017 Featured Comment Popular Post Share Posted April 12, 2017 Customers > Addresses > Set required fields for this section > Phone_mobileMake sure youre added in locations > countries > phone_mobile 14 3 Link to comment Share on other sites More sharing options...
vm0824 Posted April 12, 2017 Author Share Posted April 12, 2017 Thanks! was able to find the settings. A bit hidden, but its still there in 1.7 Link to comment Share on other sites More sharing options...
0kph Posted May 31, 2017 Share Posted May 31, 2017 Customers > Addresses > Set required fields for this section > Phone_mobile Make sure youre added in locations > countries > phone_mobile You need to know about issue connected with the option "Set required fields for this section" from Back Office (at least in 1.7.1.1). Eg.: when you set the 'phone' field as 'required' and you have already customers in database who did not enter phone number during last orders, they will not able to make new orders. They will get Error 500 screen. My customers was not able to find out why they havegot this nic error... IMHO the option should has the warning about consequences it or there should check all entries in database before save new set of required fields. 1 Link to comment Share on other sites More sharing options...
luca82 Posted June 8, 2017 Share Posted June 8, 2017 If you have an account and the phone is not insert, the page of order will get Error 500. Link to comment Share on other sites More sharing options...
Guest mmismail Posted July 10, 2017 Share Posted July 10, 2017 Thanks! was able to find the settings. A bit hidden, but its still there in 1.7 Can you please let me know where is that hidden settings ? Link to comment Share on other sites More sharing options...
vm0824 Posted July 10, 2017 Author Share Posted July 10, 2017 as Vilius said Customers > Addresses > Set required fields for this section > Phone_mobileMake sure youre added in locations > countries > phone_mobile Link to comment Share on other sites More sharing options...
varma dandu Posted July 26, 2017 Share Posted July 26, 2017 (edited) More details http://forge.prestashop.com/browse/NM-895 PS 1.7.1 i have selected my required fields but when i remove un wanted fields from location which are non mandatory its throwing 500 for me can some one help me pls Edited July 26, 2017 by varma dandu (see edit history) Link to comment Share on other sites More sharing options...
kapselj Posted November 17, 2017 Share Posted November 17, 2017 Hi Varma, Have you solved this issue? I faced same problems - PS 1.7.2.4. If phone field is set as mandatory PS returns error 500. Many thanks Karol Link to comment Share on other sites More sharing options...
vm0824 Posted November 17, 2017 Author Share Posted November 17, 2017 On 6/8/2017 at 10:36 AM, luca82 said: If you have an account and the phone is not insert, the page of order will get Error 500. likely that you already have accounts created without phone numbers. you'll have to populate them Link to comment Share on other sites More sharing options...
archproject Posted February 3, 2018 Share Posted February 3, 2018 Below there is a button for it. just click that heheheh Link to comment Share on other sites More sharing options...
oldsmokers Posted February 23, 2018 Share Posted February 23, 2018 Prestashop doesn't fix it yet ???? Why ERROR 500??? Link to comment Share on other sites More sharing options...
bellini13 Posted February 23, 2018 Share Posted February 23, 2018 what exactly are you expecting prestashop to fix? Did you report some kind of issue to prestashop using their forge?r Link to comment Share on other sites More sharing options...
Kami Solutions Posted May 10, 2018 Share Posted May 10, 2018 If you get error 500 this is because your country/countries doesn't have the mandatory field you want to add, that's why you are getting error 500. What happens if you want to add a mandatory field for DELIVERY ONLY or INVOICE ONLY??? Any ideas or where to edit? I'm not really familiar with php. Regards Link to comment Share on other sites More sharing options...
Marco Posted September 18, 2018 Share Posted September 18, 2018 Guys, I would like to ask you this: Is there a way to manually add a phone (or others) field in the "already-registered-customer" page? I mean, if we can add the wanted field in the customer information's page, we could "ask" them to update their infos. So, if people updates all the required fields, they shouldn't have problems. Now, i know that saying that is simple, the problem is to find the way to "add" this field. Is there someone that knows something about that? Link to comment Share on other sites More sharing options...
bellini13 Posted September 18, 2018 Share Posted September 18, 2018 1 hour ago, Marco said: Is there a way to manually add a phone (or others) field in the "already-registered-customer" page? Could elaborate on what this means exactly? What is an 'already registered customer page' ? Perhaps provide a screen shot Link to comment Share on other sites More sharing options...
DEN Posted December 26, 2018 Share Posted December 26, 2018 (edited) Hey guys.....This is SOLVED PS 1.7xx !! I found the answer to this question, I was having the same issue with the phone number, I wanted the phone # mandatory. No coding need, just a simple checked mark is needed. In your BO > Customers > Addresses> @ the bottom of your customer list there is " + set required fields for this section" click that button. Check all fields you need, including phone number!! Only took me 2 weeks to figure this out. I couldn't find this anywhere. Hope this help. Edited December 26, 2018 by DEN not solved (see edit history) Link to comment Share on other sites More sharing options...
DEN Posted December 26, 2018 Share Posted December 26, 2018 Sorry guys Changing this give me an 500 error. Im working on this. if and when I find a fix, I will post. 1 Link to comment Share on other sites More sharing options...
DEN Posted December 26, 2018 Share Posted December 26, 2018 Alright Guys, this will make the phone number mandatory in your checkout/cart I got this to work. Hope this fix works for you. 1st go here. In your BO > Customers > Addresses> @ the bottom of your customer list there is " + set required fields for this section" click that button. UNCHECK ALL>>>> save!! Next, go here>>> International>> Locations>> Countries >> for me, edit " USA " (I only sell in the USA. This part can get tricky, for ALL the countries you have in your checkout/cart, you must do this to.) This is how mine is setup: firstname lastname company address1 address2 State:name postcode city phone Country:name SAVE YOUR WORK!!! After setting this up, make sure this works in the checkout/cart. (for all counties) with OUT errors. Do some testing. At this point , phone will still be optional. Again , make sure it works before moving on, very important!!! Next >> go back to In your BO > Customers > Addresses> @ the bottom of your customer list there is " + set required fields for this section" click that button. Now check mark ONLY the phone, SAVE! This makes it Mandatory. For some reason, my screen shots would not upload, sorry. Now this is SOLVED! Hope this help ya. 1 1 Link to comment Share on other sites More sharing options...
enigma32 Posted January 15, 2019 Share Posted January 15, 2019 But its not solved still... I populate all pre-existing addresses in database so they dont have blank/null phone fields. Submit address during test checkout with phone number and it goes to 500 page. No error reporting anywhere either. Link to comment Share on other sites More sharing options...
enigma32 Posted January 15, 2019 Share Posted January 15, 2019 Further debugging.. when phone is set as required, form submit says id_country is not set Link to comment Share on other sites More sharing options...
JohnDom Posted March 29, 2019 Share Posted March 29, 2019 I don't get this error anymore, seems to be fixed now. I am running 1.7.4.4 and if I add the telephone as required field, existing customers that do not have that field populated, are warned that there is a field missing and the continue button is greyed out until they add it. I simply added the mandatory field through: BO > Customers > Addresses> @ the bottom of your customer list there is " + set required fields for this section" click that button. Link to comment Share on other sites More sharing options...
Martin Mi Posted July 23, 2020 Share Posted July 23, 2020 On 4/12/2017 at 4:43 PM, Vilius PromoApranga said: Customers > Addresses > Set required fields for this section > Phone_mobile Make sure youre added in locations > countries > phone_mobile This works perfectly in PrestaShop 1.7.2. Thanks! 1 Link to comment Share on other sites More sharing options...
airtogazta Posted October 1, 2020 Share Posted October 1, 2020 (edited) Hi! We were having these issues and even if in the BO we set 'phone_mobile' to be mandatory, it would reset after some time. The solution I found was to edit the required fields list inside classes/AddressFormat.php; not sure if that's the best way but it worked for us. Edited October 1, 2020 by airtogazta typo (see edit history) Link to comment Share on other sites More sharing options...
jacksfregio Posted October 22, 2020 Share Posted October 22, 2020 On 10/1/2020 at 11:34 AM, airtogazta said: Hi! We were having these issues and even if in the BO we set 'phone_mobile' to be mandatory, it would reset after some time. The solution I found was to edit the required fields list inside classes/AddressFormat.php; not sure if that's the best way but it worked for us. Same problem, after some time, it resets Link to comment Share on other sites More sharing options...
nikos83 Posted March 16, 2021 Share Posted March 16, 2021 (edited) Same problem here I've updated to newest 1.7.7.2 and after I save required fields it works and I got new record inside ps_required_field but when refresh form it resets. All records from ps_required_field diapered. Change AddressFormat.php and adding there phone to required fields helps so probably the best way will be create override fot this class. Edited March 16, 2021 by nikos83 (see edit history) 1 Link to comment Share on other sites More sharing options...
chaospace Posted March 20, 2021 Share Posted March 20, 2021 On 3/16/2021 at 2:45 PM, nikos83 said: Same problem here I've updated to newest 1.7.7.2 and after I save required fields it works and I got new record inside ps_required_field but when refresh form it resets. All records from ps_required_field diapered. Change AddressFormat.php and adding there phone to required fields helps so probably the best way will be create override fot this class. Confirming this solution. I just was about to recommend the same. Link to comment Share on other sites More sharing options...
HairMaker.Gr Posted July 17 Share Posted July 17 Martin Mi working perfectly at 8.1.4 version. Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Posted by Vilius PromoApranga,
This solution works
Recommended by Mehrshad Zakerian
17 reactions
Go to this post
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