Littlepants Posted March 2, 2017 Share Posted March 2, 2017 Dos anyone know if customers can be automatically assigned into a specific group, in addition to the normal customer group, by their post code? Link to comment Share on other sites More sharing options...
Littlepants Posted March 2, 2017 Author Share Posted March 2, 2017 Thanks, but how do I do it? I want any customer who registers with 3 particular post code beginnings to be automatically added to a group. Link to comment Share on other sites More sharing options...
Littlepants Posted March 3, 2017 Author Share Posted March 3, 2017 OK, as there's been no response to my last efforts, how do I make a new group which automatically includes local addresses? Link to comment Share on other sites More sharing options...
Guest Posted March 3, 2017 Share Posted March 3, 2017 Have you tried any of these modules? https://addons.prestashop.com/en/search?id_category=0&search_query=group+by+postciode Link to comment Share on other sites More sharing options...
Littlepants Posted March 3, 2017 Author Share Posted March 3, 2017 None of that makes any sense to me. The modules suggested are nothing to do with groups as far as I can see, and I have a VERY small shop, and can't afford to pay for modules anyway. I just wanted a simple way to make a new group, but there seems to be no way in the back office of regulating who is in a group. Link to comment Share on other sites More sharing options...
rocky Posted March 4, 2017 Share Posted March 4, 2017 You should create override/controllers/front/AuthController.php to override the AuthController::processSubmitAccount() function like this: <?php class AuthController extends AuthControllerCore { protected function processSubmitAccount() { } } It's probably easiest if you copy the entire function and then find this code: $postcode = $$addresses_type->postcode; /* Check zip code format */ if ($country->zip_code_format && !$country->checkZipCode($postcode)) { $this->errors[] = sprintf(Tools::displayError('The Zip/Postal code you\'ve entered is invalid. It must follow this format: %s'), str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $country->zip_code_format)))); } elseif (empty($postcode) && $country->need_zip_code) { $this->errors[] = Tools::displayError('A Zip / Postal code is required.'); } elseif ($postcode && !Validate::isPostCode($postcode)) { $this->errors[] = Tools::displayError('The Zip / Postal code is invalid.'); } After this code, you can write something like this: if (substr($postcode, 0, 2) == '48') { $customer->addGroups(array(1)); } This should add the customer to group 1 if their postcode starts with 48. Change the code as necessary. After you've created your override, go to Advanced Parameters > Performance and then click the "Clear cache" button (or manually delete cache/class_index.php) so PrestaShop can find the override. I hope this points you in the right direction. Link to comment Share on other sites More sharing options...
Littlepants Posted March 4, 2017 Author Share Posted March 4, 2017 (edited) Thanks but that's all double dutch to me. I don't have anything that looks remote like that. I have options of : Dashboard Catalog Orders Customers Price rules Shipping Localisation Modules and services Preferences Advanced parameters Administration Stats Where do I go from here please? Edited March 4, 2017 by Littlepants (see edit history) Link to comment Share on other sites More sharing options...
rocky Posted March 4, 2017 Share Posted March 4, 2017 Sorry, what you want to do isn't possible through the Back Office. You'll need to get your hands dirty by copying and pasting code and modifying it. 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