patrmich Posted March 5, 2014 Share Posted March 5, 2014 Hi,In Prestashop 1.5.6, in the database, all the customer address fields are saved in lower case (apart from the first letter).Unfortunately, this is not in conformity with the Postal standards in France where all the address fields are to be printed in uppercase.In Prestashop 1.4, several people publish the way to make the address registration in uppercase :In "classes" find "Customer.php" and "Address.php"Replace the line :$fields['lastname'] = pSQL($this->lastname);by :$fields['lastname'] = pSQL(Tools::strtoupper($this->lastname));That method worked well.For prestahsop 1.5.6, would you know how to have the various fields of the customer address in uppercase in the database ?Thank you in advance for any reply.Patrick Link to comment Share on other sites More sharing options...
prestatent Posted March 5, 2014 Share Posted March 5, 2014 Hi I'm using 1.5.4.1 so this may help point you in the right direction. Go to /controllers/front/Authcontroller.php Look for function: protected function processSubmitAccount() In this function, look for $_POST['lastname'] = Tools::getValue('customer_lastname'); This is probably where the code should go. Cheers Link to comment Share on other sites More sharing options...
patrmich Posted March 5, 2014 Author Share Posted March 5, 2014 Hi, Thank you prestatent for your prompt reply. What amendment would I have to do : replacing (?) : $_POST['lastname'] = Tools::getValue('customer_lastname'); by $_POST['lastname'] = Tools::strtoupper getValue('customer_lastname'); Thank you very much in advance. Patrick Link to comment Share on other sites More sharing options...
prestatent Posted March 5, 2014 Share Posted March 5, 2014 This should do it: $_POST['lastname'] = Tools::strtoupper(getValue('customer_lastname')); OR $_POST['lastname'] = strtoupper(Tools::getValue('customer_lastname')); Link to comment Share on other sites More sharing options...
patrmich Posted March 5, 2014 Author Share Posted March 5, 2014 Hi prestadent. Thank you again for your very prompt reply. I tested the two solutions, but none of them lead to put in uppercase the lastname (nor in the data base neither in Control Panel > Customer) Patrick Link to comment Share on other sites More sharing options...
prestatent Posted March 5, 2014 Share Posted March 5, 2014 Hi I've just put this code into the program and it does indeed work. $_POST['lastname'] = strtoupper(Tools::getValue('customer_lastname')); You may want to turn off the cache and force compile templates and then try again. Link to comment Share on other sites More sharing options...
patrmich Posted March 5, 2014 Author Share Posted March 5, 2014 (edited) Hi, 1- I checked that I made properly the amendment in controllers/front/AuthController.php replacing : $_POST['lastname'] = Tools::getValue('customer_lastname'); by $_POST['lastname'] = strtoupper(Tools::getValue('customer_lastname')); 2- I have just made a new test order. For both such test and the previous ones, the settings were as follows : Forcer la compilation à chaque appel : checked Cache : checked 3- I made the orders as a guest 4- Unfortunately, the lastname was not put into uppercase 5- My Prestashop version is 1.5.6.0. Yours is 1.5.4.1. Could this make a difference ? Thank you again. Patrick Edited March 5, 2014 by patrmich (see edit history) Link to comment Share on other sites More sharing options...
prestatent Posted March 5, 2014 Share Posted March 5, 2014 Hi Patrick I've just created a test order on my localhost. After adding the item to the basket and going to checkout, I then have to register. At this point, when I'm asked to input the address the lastname comes through to the form as uppercase. My prestashop version is 1.5.4.1. Another thing to try is to delete the class_index.php file from the cache folder. Also empty your browser cache. Refresh your page and it should work unless something has changed between versions. Link to comment Share on other sites More sharing options...
patrmich Posted March 5, 2014 Author Share Posted March 5, 2014 Hi,Thank you again for your time.I did not manage to get the last name in upper case.But anyway, I would not want to have the address displayed in upper case on the front office.I should prefer that the customer does not feel that what he types is not what is displayed.When using Prestashop 1.4 and amending the Customer.php and Address.php files, the customer didn't see any difference with the usual behaviour.What he typed was what was displayed (except from the first letter of each field that was automatically capitalized).But in the database, the fields were stored in upper case.So, with Prestashop 1.5.6, my wish would be to do the same :- keep the fields in lower case (apart from the first letter) on the Front Office- have the fields stored in upper case in the database.Thank you again for any idea.Patrick Link to comment Share on other sites More sharing options...
prestatent Posted March 6, 2014 Share Posted March 6, 2014 Hi Patrick Unfortunately I don't have any more time to spend on this issue and I'm out of suggestions. Sorry. Hopefully someone else can help with this. Cheers Link to comment Share on other sites More sharing options...
patrmich Posted March 7, 2014 Author Share Posted March 7, 2014 Hi prestatent, Thank you for your time. In case it may have an interest for you, I am giving you here below the link to a post where someone found an indirect way, with a php script and a cron task, to put the data in uppercase every minute in the database : http://www.prestashop.com/forums/topic/83463-resolu-forcer-les-majuscules/?hl=%2Bmajuscules+%2Bbase+%2Bdonn%C3%A9es&do=findComment&comment=1237179 I hope that someone can find a lighter way to do in Prestashop 1.5 what was so easy in Prestashop 1.4 (putting the fields of the customer address in uppercase in the database). Once again thank you for the time you spent trying to give help. Patrick Link to comment Share on other sites More sharing options...
jordipalet Posted February 2, 2016 Share Posted February 2, 2016 Hi, I'm also in 1.5.4.1, I succeded to have both the fields of the customer stored with the first letter in upper case at registration or when modified. But for the address, it only works if the address is modified, not when it is created the first time. Any hint of what I'm missing ? Here is what I've done up to now: /controllers/front/AuthController.php $customer->firstname = Tools::ucwords($customer->firstname); $customer->lastname = Tools::ucwords($customer->lastname); /controllers/front/IdentityController.php $this->customer->firstname = Tools::ucwords($this->customer->firstname); $this->customer->lastname = Tools::ucwords($this->customer->lastname); However for /controllers/front/AddressController.php, only this worked for me: $address->firstname = Tools::ucwords(Tools::getValue('firstname')); $address->lastname = Tools::ucwords(Tools::getValue('lastname')); $address->address1 = Tools::ucwords(Tools::getValue('address1')); $address->address2 = Tools::ucwords(Tools::getValue('address2')); $address->company = Tools::ucwords(Tools::getValue('company')); $address->dni = Tools::ucwords(Tools::getValue('dni')); $address->city = Tools::ucwords(Tools::getValue('city')); $address->vat_number = Tools::ucwords(Tools::getValue('vat_number')); $postcode = Tools::ucwords(Tools::getValue('postcode')); 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