Donnerberg Posted February 6, 2017 Share Posted February 6, 2017 Hello,I wish to separate Address textbox to Street name and Street number.Some customers writes just a street name ( with out street number ) and then we can not sent package. Also we lose sometimes and few days before we contact customer and get the street number from him. For example instead of "Downing Street 5" I wish two different fields Street name: "Downing Street:" and under that Street number: "5" Thanks for answer ! Link to comment Share on other sites More sharing options...
JeredBolton Posted February 7, 2017 Share Posted February 7, 2017 You'll need to follow the steps provided here: http://nemops.com/new-customer-address-fields-prestashop/#.WJnQLNVanmE Link to comment Share on other sites More sharing options...
musicmaster Posted February 22, 2018 Share Posted February 22, 2018 (edited) I solved this problem by checking for a number in the address fields. That way there is no extra field. Of course it will give false positives with some street names that contain a number, but I think that problem is marginal. What I did was adapting the function processSubmitAccount() in controllers/front/authController.php. In my PS version (1.6.0.14) that is around line 407. I added the following code (the first two and last lines are in the original to give you context): if ($error_phone) $this->errors[] = Tools::displayError('You must register at least one phone number.'); $address1 = Tools::getValue('address1'); $address2 = Tools::getValue('address2'); if($address1 != "") { if((!preg_match('/[0-9]/', $address1)) && (!preg_match('/[0-9]/', $address2))) $this->errors[] = Tools::displayError('You must provide a house number.'); } $this->errors = array_unique(array_merge($this->errors, $customer->validateController())); Of course you can make this an override. Edited February 22, 2018 by musicmaster (see edit history) Link to comment Share on other sites More sharing options...
Guest Posted February 22, 2018 Share Posted February 22, 2018 I would say be careful. Many customers do not have a street number anyway. Some times they have a house Name instead of a number Link to comment Share on other sites More sharing options...
reinoplantae Posted June 5, 2020 Share Posted June 5, 2020 On 2/22/2018 at 7:05 AM, musicmaster said: I solved this problem by checking for a number in the address fields. That way there is no extra field. Of course it will give false positives with some street names that contain a number, but I think that problem is marginal. What I did was adapting the function processSubmitAccount() in controllers/front/authController.php. In my PS version (1.6.0.14) that is around line 407. I added the following code (the first two and last lines are in the original to give you context): if ($error_phone) $this->errors[] = Tools::displayError('You must register at least one phone number.'); $address1 = Tools::getValue('address1'); $address2 = Tools::getValue('address2'); if($address1 != "") { if((!preg_match('/[0-9]/', $address1)) && (!preg_match('/[0-9]/', $address2))) $this->errors[] = Tools::displayError('You must provide a house number.'); } $this->errors = array_unique(array_merge($this->errors, $customer->validateController())); Of course you can make this an override. Hi there, i tried this in my PS 1.6.1.10 but it's not working. I have a authController.php in my override folder and I also did the change there, no effects. Is this code correct?? Why the 'if ($error_phone)' condition is not followed by a { ???? This is my original authController.php file lines: if ($error_phone) { $this->errors[] = Tools::displayError('You must register at least one phone number.'); } $this->errors = array_unique(array_merge($this->errors, $customer->validateController())); Link to comment Share on other sites More sharing options...
musicmaster Posted June 11, 2020 Share Posted June 11, 2020 On 6/5/2020 at 7:09 PM, reinoplantae said: Why the 'if ($error_phone)' condition is not followed by a { ???? Do you know anything about php? You are free to use a an opening {, provided you provide a closing } too. 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