zomigi Posted October 15, 2009 Share Posted October 15, 2009 My client wants to have two different groups of customers on his site. One of the groups gets to see more product and has reduced pricing (we'll call these customers "designers"). It's easy to create a customer group called "designers" and manually assign people to it. But my client wants to be able to have the designers register through a different form than the rest of the customers use, with some different fields, so they'll automatically be placed into the designer group after submitting this form.How can I create multiple registration forms that assign customers into different groups?The next thing is even trickier: Can you set up a way to catch the new designers registering and have an admin approve them before their accounts are fully registered and they can log in? Link to comment Share on other sites More sharing options...
zomigi Posted October 15, 2009 Author Share Posted October 15, 2009 Does anyone have an idea on this? Link to comment Share on other sites More sharing options...
zomigi Posted October 26, 2009 Author Share Posted October 26, 2009 I guess I'll bump this one more time.Is this sort of thing even feasible with PrestaShop, or should I look at software from someone else? I'm willing to pay for this customization.Thanks. Link to comment Share on other sites More sharing options...
erwanpia Posted November 5, 2009 Share Posted November 5, 2009 Hi, I'm looking for that feature toothere's a start of solution herehttp://www.prestashop.com/forums/viewthread/30883/modules___development/automated_customer_group_allocation/ Link to comment Share on other sites More sharing options...
johnme Posted June 25, 2011 Share Posted June 25, 2011 Yes . i too while Registration option like , distributor, big Sellers , small sellers , We can specific price s For each group From backofficei too need this really Link to comment Share on other sites More sharing options...
sunandmoon21 Posted June 30, 2011 Share Posted June 30, 2011 Is there any solution for this? Link to comment Share on other sites More sharing options...
NikPraskaton Posted September 18, 2011 Share Posted September 18, 2011 Okay, I have manage to get to one stage.. and the problem now is this: I have created copies of authentication files.. and just renamed them to authentication2, my-account2 etc.. Why do I get this error: Warning: require_once(/home4/xxcomhr/public_html/akm-novo/config/../classes/AuthController2.php) [function.require-once]: failed to open stream: No such file or directory in /home4/xxcomhr/public_html/akm-novo/config/autoload.php on line 41 Fatal error: require_once() [function.require]: Failed opening required '/home4/xxcomhr/public_html/akm-novo/config/../classes/AuthController2.php' (include_path='.:/usr/lib64/php:/usr/lib/php:/usr/share/pear') in /home4/xxcomhr/public_html/akm-novo/config/autoload.php on line 41 The path is working fine with original file.. so I didnt change anything except renamed the files (the idea is to have different .tpl files and to have wholesaler registration) Can someone please help me with wrong path issue. Thanks. Link to comment Share on other sites More sharing options...
NikPraskaton Posted September 20, 2011 Share Posted September 20, 2011 Okay I found the solution. zomigi if you want it send me mail. Im not posting it here, no one was trying to help here for 2 yrs. Link to comment Share on other sites More sharing options...
Guest danielias Posted November 19, 2011 Share Posted November 19, 2011 @NikPraskaton can you help me? Link to comment Share on other sites More sharing options...
darktower777 Posted January 23, 2013 Share Posted January 23, 2013 Hello, I have seen that this topic is old but is just what I need and I have days without achieving progress. Anyone know the solution?. I've tried to rename, edit and duplicate files internally .. Thanks. Link to comment Share on other sites More sharing options...
lain Posted April 29, 2013 Share Posted April 29, 2013 (edited) Here is the way how I did it: -My needs: I have 2 different groups, default customer group and professional customer group. In default group ARE NOT requiered the fields company and identification number, but in professional group these fields are requiered. Furthermore, when somebody register an account as professional it must be manually activated and when register finish it should redirect to a CMS page showing a custom message "account must be revised by admin...." First of all, my ps version is 1.4.5.1. I am planning to move to 1.4.10 so I hope it will work. BEFORE ANY CHANGE, MAKE A BACKUP OF YOUR STORE. IT WORKED FOR ME BUT IT IS NOT GUARANTEED IT WILL WORK FOR YOU. -Duplicate in root folder the file "authentication.php" to "authentication2.php". Regular customers will register in www.yourshop.com/authentication.php and professional customers will register in www.yourshop.com/authentication2.php -In the new created file "authentication2.php" in line 29 change line ControllerFactory::getController('AuthController')->run(); by ControllerFactory::getController('AuthController2')->run(); -Duplicate controllers/AuthController.php to controllers/AuthController2.php -In controllers/Authcontroller2.php change: in line 28~: class AuthControllerCore extends FrontController by class AuthController2Core extends FrontController in line 31~ change: public $php_self = 'authentication.php'; by public $php_self = 'authentication2.php'; in line 395~ change: self::$smarty->display(_PS_THEME_DIR_.'authentication.tpl'); by self::$smarty->display(_PS_THEME_DIR_.'authentication2.tpl'); Next code is optional, as I said, in my shop default customer doesnt need identification number field, to do it I added this code: if (!Validate::isDniLite(Tools::getValue('dni'))) instead if (Country::isNeedDniByCountryId($address->id_country) AND (!Tools::getValue('dni') OR !Validate::isDniLite(Tools::getValue('dni')))) but now I want to revert that behavior. Then I will add in "AuthController2.php" the original code if (Country::isNeedDniByCountryId($address->id_country) AND (!Tools::getValue('dni') OR !Validate::isDniLite(Tools::getValue('dni')))) instead modified code if (!Validate::isDniLite(Tools::getValue('dni'))) -To keep authentication language translation working you should duplicate all the lines which start by "$_LANG['authentication_..." in "themes/yourtheme/lang/yourlang.php", the duplicated lines should start by "$_LANG['authentication2_" -Duplicate themes/yourtheme/authentication.tpl to authentication2.tpl -In themes/yourtheme/authentication2.tpl change any reference to "authentication.php" by "authentication2.php" -This is an optional step, as I said in my default group is not requiered the "company" field, so to make it requiered in new professional group I will duplicate in classes/Adress.php the line 99~, original line: protected $fieldsRequired = array('id_country', 'alias', 'lastname', 'firstname', 'address1', 'city'); duplicated and modified line protected $fieldsRequired2 = array('id_country', 'alias', 'lastname', 'firstname', 'address1', 'city','company'); -In class/ObejectModel.php duplicate the functions "validateControler" and "validateController". Duplicate from line 467~ to 513~, this: public function validateControler($htmlentities = true) { return $this->validateController($htmlentities); } public function validateController($htmlentities = true) { $errors = array(); /* Checking for required fields */ $fieldsRequired = array_merge($this->fieldsRequired, (isset(self::$fieldsRequiredDatabase[get_class($this)]) ? self::$fieldsRequiredDatabase[get_class($this)] : array())); foreach ($fieldsRequired AS $field) if (($value = Tools::getValue($field, $this->{$field})) == false AND (string)$value != '0') if (!$this->id OR $field != 'passwd') $errors[] = '<b>'.self::displayFieldName($field, get_class($this), $htmlentities).'</b> '.Tools::displayError('is required.'); /* Checking for maximum fields sizes */ foreach ($this->fieldsSize AS $field => $maxLength) if (($value = Tools::getValue($field, $this->{$field})) AND Tools::strlen($value) > $maxLength) $errors[] = '<b>'.self::displayFieldName($field, get_class($this), $htmlentities).'</b> '.Tools::displayError('is too long.').' ('.Tools::displayError('Maximum length:').' '.$maxLength.')'; /* Checking for fields validity */ foreach ($this->fieldsValidate AS $field => $function) { // Hack for postcode required for country which does not have postcodes if ($value = Tools::getValue($field, $this->{$field}) OR ($field == 'postcode' AND $value == '0')) { if (!Validate::$function($value)) $errors[] = '<b>'.self::displayFieldName($field, get_class($this), $htmlentities).'</b> '.Tools::displayError('is invalid.'); else { if ($field == 'passwd') { if ($value = Tools::getValue($field)) $this->{$field} = Tools::encrypt($value); } else $this->{$field} = $value; } } } return $errors; } in duplicated lines, do this changes: public function validateControler($htmlentities = true) by public function validateControler2($htmlentities = true) return $this->validateController($htmlentities); by return $this->validateController2($htmlentities); public function validateController($htmlentities = true) by public function validateController2($htmlentities = true) $fieldsRequired = array_merge($this->fieldsRequired, (isset(self::$fieldsRequiredDatabase[get_class($this)]) ? self::$fieldsRequiredDatabase[get_class($this)] : array())); by $fieldsRequired2 = array_merge($this->fieldsRequired2, (isset(self::$fieldsRequiredDatabase[get_class($this)]) ? self::$fieldsRequiredDatabase[get_class($this)] : array())); foreach ($fieldsRequired AS $field) by foreach ($fieldsRequired2 AS $field) -In controllers/AuthController2.php, change $this->errors = array_unique(array_merge($this->errors, $address->validateControler())); by $this->errors = array_unique(array_merge($this->errors, $address->validateControler2())); -To make new user inactive by default, change in "controllers/AuthController2.php": in line 152~ $customer->active = 1; by $customer->active = 0; in line 178~: self::$cookie->logged = 1; by self::$cookie->logged = 0; -To change the redirect behavior just when user finishes registration change in "controllers/AuthController2.php" in line 205~: Tools::redirect('my-account.php'); by Tools::redirect('cms.php?id_cms=14'); instead 'cms.php?id_cms=14' it could be your seo friendly url... 'content/customcmspage' or any url starting from www.yourshop.com Admin must activate new user and put in desired group Thanks NikPraskaton for help community NOT sharing your solution Edited April 29, 2013 by lain (see edit history) 2 Link to comment Share on other sites More sharing options...
devilsown Posted April 30, 2013 Share Posted April 30, 2013 Thanks for posting this. Link to comment Share on other sites More sharing options...
lain Posted May 14, 2013 Share Posted May 14, 2013 Related to the topic I managed to: -If user belongs to certain group, it shows their price and regular user price stroked. In product page, homefeatured and category. -I can set different amount in "Remaining amount to free shipping" depending of group. In blockcart and order summary. -Each group can see different images in banners Link to comment Share on other sites More sharing options...
citraline Posted May 21, 2013 Share Posted May 21, 2013 Here is the way how I did it: -My needs: I have 2 different groups, default customer group and professional customer group. In default group ARE NOT requiered the fields company and identification number, but in professional group these fields are requiered. Furthermore, when somebody register an account as professional it must be manually activated and when register finish it should redirect to a CMS page showing a custom message "account must be revised by admin...." First of all, my ps version is 1.4.5.1. I am planning to move to 1.4.10 so I hope it will work. BEFORE ANY CHANGE, MAKE A BACKUP OF YOUR STORE. IT WORKED FOR ME BUT IT IS NOT GUARANTEED IT WILL WORK FOR YOU. -Duplicate in root folder the file "authentication.php" to "authentication2.php". Regular customers will register in www.yourshop.com/authentication.php and professional customers will register in www.yourshop.com/authentication2.php -In the new created file "authentication2.php" in line 29 change line ControllerFactory::getController('AuthController')->run(); by ControllerFactory::getController('AuthController2')->run(); -Duplicate controllers/AuthController.php to controllers/AuthController2.php -In controllers/Authcontroller2.php change: in line 28~: class AuthControllerCore extends FrontController by class AuthController2Core extends FrontController in line 31~ change: public $php_self = 'authentication.php'; by public $php_self = 'authentication2.php'; in line 395~ change: self::$smarty->display(_PS_THEME_DIR_.'authentication.tpl'); by self::$smarty->display(_PS_THEME_DIR_.'authentication2.tpl'); Next code is optional, as I said, in my shop default customer doesnt need identification number field, to do it I added this code: if (!Validate::isDniLite(Tools::getValue('dni'))) instead if (Country::isNeedDniByCountryId($address->id_country) AND (!Tools::getValue('dni') OR !Validate::isDniLite(Tools::getValue('dni')))) but now I want to revert that behavior. Then I will add in "AuthController2.php" the original code if (Country::isNeedDniByCountryId($address->id_country) AND (!Tools::getValue('dni') OR !Validate::isDniLite(Tools::getValue('dni')))) instead modified code if (!Validate::isDniLite(Tools::getValue('dni'))) -To keep authentication language translation working you should duplicate all the lines which start by "$_LANG['authentication_..." in "themes/yourtheme/lang/yourlang.php", the duplicated lines should start by "$_LANG['authentication2_" -Duplicate themes/yourtheme/authentication.tpl to authentication2.tpl -In themes/yourtheme/authentication2.tpl change any reference to "authentication.php" by "authentication2.php" -This is an optional step, as I said in my default group is not requiered the "company" field, so to make it requiered in new professional group I will duplicate in classes/Adress.php the line 99~, original line: protected $fieldsRequired = array('id_country', 'alias', 'lastname', 'firstname', 'address1', 'city'); duplicated and modified line protected $fieldsRequired2 = array('id_country', 'alias', 'lastname', 'firstname', 'address1', 'city','company'); -In class/ObejectModel.php duplicate the functions "validateControler" and "validateController". Duplicate from line 467~ to 513~, this: public function validateControler($htmlentities = true) { return $this->validateController($htmlentities); } public function validateController($htmlentities = true) { $errors = array(); /* Checking for required fields */ $fieldsRequired = array_merge($this->fieldsRequired, (isset(self::$fieldsRequiredDatabase[get_class($this)]) ? self::$fieldsRequiredDatabase[get_class($this)] : array())); foreach ($fieldsRequired AS $field) if (($value = Tools::getValue($field, $this->{$field})) == false AND (string)$value != '0') if (!$this->id OR $field != 'passwd') $errors[] = '<b>'.self::displayFieldName($field, get_class($this), $htmlentities).'</b> '.Tools::displayError('is required.'); /* Checking for maximum fields sizes */ foreach ($this->fieldsSize AS $field => $maxLength) if (($value = Tools::getValue($field, $this->{$field})) AND Tools::strlen($value) > $maxLength) $errors[] = '<b>'.self::displayFieldName($field, get_class($this), $htmlentities).'</b> '.Tools::displayError('is too long.').' ('.Tools::displayError('Maximum length:').' '.$maxLength.')'; /* Checking for fields validity */ foreach ($this->fieldsValidate AS $field => $function) { // Hack for postcode required for country which does not have postcodes if ($value = Tools::getValue($field, $this->{$field}) OR ($field == 'postcode' AND $value == '0')) { if (!Validate::$function($value)) $errors[] = '<b>'.self::displayFieldName($field, get_class($this), $htmlentities).'</b> '.Tools::displayError('is invalid.'); else { if ($field == 'passwd') { if ($value = Tools::getValue($field)) $this->{$field} = Tools::encrypt($value); } else $this->{$field} = $value; } } } return $errors; } in duplicated lines, do this changes: public function validateControler($htmlentities = true) by public function validateControler2($htmlentities = true) return $this->validateController($htmlentities); by return $this->validateController2($htmlentities); public function validateController($htmlentities = true) by public function validateController2($htmlentities = true) $fieldsRequired = array_merge($this->fieldsRequired, (isset(self::$fieldsRequiredDatabase[get_class($this)]) ? self::$fieldsRequiredDatabase[get_class($this)] : array())); by $fieldsRequired2 = array_merge($this->fieldsRequired2, (isset(self::$fieldsRequiredDatabase[get_class($this)]) ? self::$fieldsRequiredDatabase[get_class($this)] : array())); foreach ($fieldsRequired AS $field) by foreach ($fieldsRequired2 AS $field) -In controllers/AuthController2.php, change $this->errors = array_unique(array_merge($this->errors, $address->validateControler())); by $this->errors = array_unique(array_merge($this->errors, $address->validateControler2())); -To make new user inactive by default, change in "controllers/AuthController2.php": in line 152~ $customer->active = 1; by $customer->active = 0; in line 178~: self::$cookie->logged = 1; by self::$cookie->logged = 0; -To change the redirect behavior just when user finishes registration change in "controllers/AuthController2.php" in line 205~: Tools::redirect('my-account.php'); by Tools::redirect('cms.php?id_cms=14'); instead 'cms.php?id_cms=14' it could be your seo friendly url... 'content/customcmspage' or any url starting from www.yourshop.com Admin must activate new user and put in desired group Thanks NikPraskaton for help community NOT sharing your solution Hellow Lain Thank you very much for sharing the knowledge , and special thanks to NikPraskaton too LOL I need some help please, im stucked in the first step, when i open "authentication2.php" i got this : Thank you Best Regarts CLineTech Link to comment Share on other sites More sharing options...
lain Posted May 22, 2013 Share Posted May 22, 2013 What PS version are you running? 1 Link to comment Share on other sites More sharing options...
citraline Posted May 23, 2013 Share Posted May 23, 2013 What PS version are you running? Last version Link to comment Share on other sites More sharing options...
lain Posted May 23, 2013 Share Posted May 23, 2013 (edited) Well, it seems that files are bit different from 1.4.5.1(my version) to 1.5.x (your version) I have not any store running on 1.5.x so I cant test it but it looks that changing Tools::redirect('index.php?controller=authentication'.($_REQUEST ? '&'.http_build_query($_REQUEST, '', '&') : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); to Tools::redirect('index.php?controller=authentication2'.($_REQUEST ? '&'.http_build_query($_REQUEST, '', '&') : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); and then in "AuthController2.php" change the AuthControllerCore to AuthControllerCore2 and: public $php_self = 'authentication'; to public $php_self = 'authentication2'; etc... etc... But, as I said, its not tested on 1.5.x. Edited May 23, 2013 by lain (see edit history) 1 Link to comment Share on other sites More sharing options...
citraline Posted May 23, 2013 Share Posted May 23, 2013 Well, it seems that files are bit different from 1.4.5.1(my version) to 1.5.x (your version) I have not any store running on 1.5.x so I cant test it but it looks that changing Tools::redirect('index.php?controller=authentication'.($_REQUEST ? '&'.http_build_query($_REQUEST, '', '&') : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); to Tools::redirect('index.php?controller=authentication2'.($_REQUEST ? '&'.http_build_query($_REQUEST, '', '&') : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); and then in "AuthController2.php" change the AuthControllerCore to AuthControllerCore2 and: public $php_self = 'authentication'; to public $php_self = 'authentication2'; etc... etc... But, as I said, its not tested on 1.5.x. Thank you very much, i will test and give feedback , Link to comment Share on other sites More sharing options...
Arafat Jahan Posted May 23, 2013 Share Posted May 23, 2013 My client wants to have two different groups of customers on his site. One of the groups gets to see more product and has reduced pricing (we'll call these customers "designers"). It's easy to create a customer group called "designers" and manually assign people to it. But my client wants to be able to have the designers register through a different form than the rest of the customers use, with some different fields, so they'll automatically be placed into the designer group after submitting this form. How can I create multiple registration forms that assign customers into different groups? The next thing is even trickier: Can you set up a way to catch the new designers registering and have an admin approve them before their accounts are fully registered and they can log in? Hi I can help you regarding your problem, And i have already make some core module for this type solution, like multiple user group, multiple reg form, also need admin approval for complete the reg. Contact me here:- https://www.odesk.com/users/~01d2c05933fd4dec1a Link to comment Share on other sites More sharing options...
Bob Wagstaff Posted July 7, 2013 Share Posted July 7, 2013 Thank you very much, i will test and give feedback , Could you let us know how you got on? Thanks Link to comment Share on other sites More sharing options...
nguerra Posted July 8, 2013 Share Posted July 8, 2013 Could you let us know how you got on? Thanks I tested using prestashop 1.5.4.1, and didnt work for me, the problem is that when I try to access www.mysite/index.php?controller=authentication2&back=my-account, i get error 404 the same with www.mysite.com/authentication2.php, can somebody give me some input. Thanks. Link to comment Share on other sites More sharing options...
ajnglagla Posted April 25, 2014 Share Posted April 25, 2014 hi, did you solve your problem? Link to comment Share on other sites More sharing options...
infinityecig Posted May 30, 2014 Share Posted May 30, 2014 Hi, I solved in this way, and it works tested prestashop 1.4 AuthController.php " line 132 " if (empty($address->vat_number)) $customer->id_default_group = 1; else $customer->id_default_group = 2; 1 Link to comment Share on other sites More sharing options...
japek Posted September 26, 2014 Share Posted September 26, 2014 Hi, somebody make this on prestahop 1.5. I have the same problem as @nguerra. When try run controller=authentication2 i have 404 error. Link to comment Share on other sites More sharing options...
josemalp Posted November 13, 2014 Share Posted November 13, 2014 Hello, I am, working with Prestashop 1.6 and I can´t make separate registration forms for different customer groups, I change authcotroller and authentication.tpl but it doesn´t work. Anybody can help me? Thanks Link to comment Share on other sites More sharing options...
josemalp Posted November 13, 2014 Share Posted November 13, 2014 Okay I found the solution. zomigi if you want it send me mail. Im not posting it here, no one was trying to help here for 2 yrs. I have the same problem. Could you help me? I work in prestashop 1.6 Link to comment Share on other sites More sharing options...
fiomaravilha Posted February 14, 2015 Share Posted February 14, 2015 Has anyone been able to do this (two different registration forms) on 1.6? I have been browsing the web for days and I haven't found anyone able to do it. Thanks Link to comment Share on other sites More sharing options...
PankajThakur Posted March 16, 2015 Share Posted March 16, 2015 (edited) separate registration forms for different customer groups in prestashop 1.6 i am creating different groups where if user will registered from the student group then he got 10% discount so if there is any free module or any help then please tell .... and i also need help that students group registration fields are to be changed thanks in advance Edited March 16, 2015 by PankajThakur (see edit history) Link to comment Share on other sites More sharing options...
Liniuxx Posted May 6, 2015 Share Posted May 6, 2015 Same here PS 1.6 separate registration form needed....please help.. Link to comment Share on other sites More sharing options...
seyi Posted August 21, 2015 Share Posted August 21, 2015 (edited) Ok, I could not find any extensions that do this for prestashop 1.6, so ended up building the functionality myself. Please backup any files before attempting to making any changes detailed in this post. My needs: the functionality to create a separate registration page for a wholesale account. In processing the registration, the account is initially inactive and a notification email is sent to the admin to prompt him/her to approve. Here is the full code: wholesale_registration.zip Edit: Above link does not seem to work anymore, here is dropbox link: https://www.dropbox.com/s/hu6nc5yy91mupd7/wholesale_registration.zip?dl=0 1. Added the override file: /override/controllers/front/AuthController.php THIS IS NOT THE FULL CODE SO DO NOT COPY AND PASTE <?php class AuthController extends AuthControllerCore { public $wholesale_customer_group = 4; // // // more code here // // public function processSubmitAccountWholesale() { $this->processSubmitAccountWholesaleCreateAccount(); if(empty($this->errors)) { $customer = $this->context->customer; // add customer to wholesale group $customer->cleanGroups(); // delete all customer groups $customer->addGroups(array((int)$this->wholesale_customer_group)); // disable customer, needs approval if($customer->active==1) $customer->toggleStatus(); // send email to admin for approval Mail::Send( $this->context->language->id, 'wholesale_registration', Mail::l('Wholesale Registration'), array( '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{passwd}' => Tools::getValue('passwd')), Configuration::get('PS_SHOP_EMAIL'), Configuration::get('PS_SHOP_NAME') ); // now log the customer out $customer->logout(); // // finishing touches from processSubmitAccount() // if (!$customer->is_guest) if (!$this->sendConfirmationMail($customer)) $this->errors[] = Tools::displayError('The email cannot be sent.'); if ($this->ajax) { $return = array( 'hasError' => !empty($this->errors), 'errors' => $this->errors, 'isSaved' => true, 'id_customer' => (int)$this->context->cookie->id_customer, 'id_address_delivery' => $this->context->cart->id_address_delivery, 'id_address_invoice' => $this->context->cart->id_address_invoice, 'token' => Tools::getToken(false) ); die(Tools::jsonEncode($return)); } Tools::redirect('index.php?controller=authentication&layout=wholesale_confirm'); } } // // // more code here // // } If you need to edit this file, the above are most likely what you need to edit. $wholesale_customer_group is the id of the wholesale customer group. Function processSubmitAccountWholesale adds the customer to the wholesale group, inactivates the account, logs out the user, and sends the notification email to the admin. One other note, if you are are adding this file for the first time, you will need to delete or rename the file /cache/class_index.php for the override to take effect. 2. Add the registration template file /themes/[YOUR_THEME]/authentication_wholesale.tpl This file is just a copy of /themes/[YOUR_THEME]/authentication.tpl, with 2 changes First I changed: <form action="{$link->getPageLink('authentication', true)|escape:'html':'UTF-8'}" method="post" id="account-creation_form" class="std box"> to this <form action="{$link->getPageLink('authentication', true, NULL, 'layout=wholesale')|escape:'html':'UTF-8'}" method="post" id="account-creation_form" class="std box"> And changed this <button type="submit" name="submitAccount" id="submitAccount" class="btn btn-default button button-medium"> to this: <button type="submit" name="SubmitAccountWholesale" id="SubmitAccountWholesale" class="btn btn-default button button-medium"> 3. Add the registration confirmation template /themes/[YOUR_THEME]/authentication_wholesale_confirm.php This is just the confirmation page that is shown after registering on the wholesale confirmation account 4. Add the mail templates /themes/[YOUR_THEME]/mails/[iSO]/wholesale_registration.html /themes/[YOUR_THEME]/mails/[iSO]/wholesale_registration.txt This is the email notification sent to the admin That is it. If everything is done correctly, you will be able to access the separate registration page here: [YOUR_WEBSITE_ADDRESS]/index.php?controller=authentication&layout=wholesale Here is the full code: wholesale_registration.zip Edit: Above link does not seem to work anymore, here is dropbox link: https://www.dropbox.com/s/hu6nc5yy91mupd7/wholesale_registration.zip?dl=0 Edited January 5, 2016 by seyi (see edit history) 1 Link to comment Share on other sites More sharing options...
rumo Posted September 5, 2015 Share Posted September 5, 2015 Hi, This not work in v.1.6.1.1 ? Have tried it and the result is the following: -Admin Receives no mail about registration- Wholesale customer is registered in the standard customer group (ID1) and are automatically logged on customer backoffice.From what I understand of these modified codes, the following happen:- Customer group "wholesale" should be created (group ID4)- When a wholesale customer signs up, this customer will automatically be added to wholesale group ID4, but inactive to admin has approved this customer. Admin will receive an email about this.Have I misunderstood something here? Link to comment Share on other sites More sharing options...
seyi Posted September 6, 2015 Share Posted September 6, 2015 Hello, In your authentication_wholesale.tpl, did you update the form action and the submit button? For the override AuthController.php, you got that direct from the download right, not copied from the post? And you cleared the class cache by deleting or rename the file /cache/class_index.php Link to comment Share on other sites More sharing options...
ghizlanebel Posted September 17, 2015 Share Posted September 17, 2015 hi sey thanx for the help,am a prestashop biginner and i want to know howt to update the form action and the submit button in the tpl file thx Link to comment Share on other sites More sharing options...
rumo Posted September 24, 2015 Share Posted September 24, 2015 Hello, In your authentication_wholesale.tpl, did you update the form action and the submit button? For the override AuthController.php, you got that direct from the download right, not copied from the post? And you cleared the class cache by deleting or rename the file /cache/class_index.php I downloaded the file and overwrote the original files. Deleted file /cache/class_index.phpbut was still the same, registered in one group Yes I update the form action and the submit button. Link to comment Share on other sites More sharing options...
Mellowy Posted January 5, 2016 Share Posted January 5, 2016 (edited) Ok, I could not find any extensions that do this for prestashop 1.6, so ended up building the functionality myself. Please backup any files before attempting to making any changes detailed in this post. My needs: the functionality to create a separate registration page for a wholesale account. In processing the registration, the account is initially inactive and a notification email is sent to the admin to prompt him/her to approve. Here is the full code: wholesale_registration.zip 1. Added the override file: /override/controllers/front/AuthController.php THIS IS NOT THE FULL CODE SO DO NOT COPY AND PASTE <?php class AuthController extends AuthControllerCore { public $wholesale_customer_group = 4; // // // more code here // // public function processSubmitAccountWholesale() { $this->processSubmitAccountWholesaleCreateAccount(); if(empty($this->errors)) { $customer = $this->context->customer; // add customer to wholesale group $customer->cleanGroups(); // delete all customer groups $customer->addGroups(array((int)$this->wholesale_customer_group)); // disable customer, needs approval if($customer->active==1) $customer->toggleStatus(); // send email to admin for approval Mail::Send( $this->context->language->id, 'wholesale_registration', Mail::l('Wholesale Registration'), array( '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{passwd}' => Tools::getValue('passwd')), Configuration::get('PS_SHOP_EMAIL'), Configuration::get('PS_SHOP_NAME') ); // now log the customer out $customer->logout(); // // finishing touches from processSubmitAccount() // if (!$customer->is_guest) if (!$this->sendConfirmationMail($customer)) $this->errors[] = Tools::displayError('The email cannot be sent.'); if ($this->ajax) { $return = array( 'hasError' => !empty($this->errors), 'errors' => $this->errors, 'isSaved' => true, 'id_customer' => (int)$this->context->cookie->id_customer, 'id_address_delivery' => $this->context->cart->id_address_delivery, 'id_address_invoice' => $this->context->cart->id_address_invoice, 'token' => Tools::getToken(false) ); die(Tools::jsonEncode($return)); } Tools::redirect('index.php?controller=authentication&layout=wholesale_confirm'); } } // // // more code here // // } If you need to edit this file, the above are most likely what you need to edit. $wholesale_customer_group is the id of the wholesale customer group. Function processSubmitAccountWholesale adds the customer to the wholesale group, inactivates the account, logs out the user, and sends the notification email to the admin. One other note, if you are are adding this file for the first time, you will need to delete or rename the file /cache/class_index.php for the override to take effect. 2. Add the registration template file /themes/[YOUR_THEME]/authentication_wholesale.tpl This file is just a copy of /themes/[YOUR_THEME]/authentication.tpl, with 2 changes First I changed: <form action="{$link->getPageLink('authentication', true)|escape:'html':'UTF-8'}" method="post" id="account-creation_form" class="std box"> to this <form action="{$link->getPageLink('authentication', true, NULL, 'layout=wholesale')|escape:'html':'UTF-8'}" method="post" id="account-creation_form" class="std box"> And changed this <button type="submit" name="submitAccount" id="submitAccount" class="btn btn-default button button-medium"> to this: <button type="submit" name="SubmitAccountWholesale" id="SubmitAccountWholesale" class="btn btn-default button button-medium"> 3. Add the registration confirmation template /themes/[YOUR_THEME]/authentication_wholesale_confirm.php This is just the confirmation page that is shown after registering on the wholesale confirmation account 4. Add the mail templates /themes/[YOUR_THEME]/mails/[iSO]/wholesale_registration.html /themes/[YOUR_THEME]/mails/[iSO]/wholesale_registration.txt This is the email notification sent to the admin That is it. If everything is done correctly, you will be able to access the separate registration page here: [YOUR_WEBSITE_ADDRESS]/index.php?controller=authentication&layout=wholesale Here is the full code: wholesale_registration.zip Does anyone have this file still? I'm getting an error trying to download the attachment and I desperately need this fix as it's exactly what I'm trying to do. Edited January 5, 2016 by Mellowy (see edit history) Link to comment Share on other sites More sharing options...
Mellowy Posted January 14, 2016 Share Posted January 14, 2016 (edited) The solution by seyi seems to work perfectly! Well, except for one small bug. If there's an error in the validation, I get redirected to the normal authentication page (no &layout=wholesale in the url). Any way to change that? Edited January 14, 2016 by Mellowy (see edit history) Link to comment Share on other sites More sharing options...
seyi Posted January 15, 2016 Share Posted January 15, 2016 Glad to hear it works. In your authentication_wholesale.tpl, is the form url as such? <form action="{$link->getPageLink('authentication', true, NULL, 'layout=wholesale')|escape:'html':'UTF-8'}" method="post" id="account-creation_form" class="std box"> The "layout=wholesale" is very important Link to comment Share on other sites More sharing options...
hatak Posted January 15, 2016 Share Posted January 15, 2016 I resolve this issue in different way - It's simpler I think.... result of this modification: you will be able to add company name (and vat nr) only with customer form (not guest checkout) and if you provide name of company you will be automaticaly added to defined group first change tpls - order-opc-new-account-advanced.tpl and order-opc-new-account.tpl (the same) for divs regarded to company add class "is_customer_param" like <div class="form-group is_customer_param"> <label for="company_invoice"> in database ps_configuration table add parametter PS_COMPANY_GROUP with appropriate id of group (4 or above) in AuthController.php (or do overdrive) change line // we add the guest customer in the default customer group $customer->addGroups(array((int)Configuration::get('PS_CUSTOMER_GROUP'))); to // we add the guest customer in the default customer group if (empty($address->vat_number)) { $customer->addGroups(array((int)Configuration::get('PS_CUSTOMER_GROUP'))); } else { $customer->addGroups(array((int)Configuration::get('PS_COMPANY_GROUP'))); } it's code of ps1.6.1.2 in other versions could be simillar and enjoy 1 Link to comment Share on other sites More sharing options...
wodzienka Posted August 16, 2016 Share Posted August 16, 2016 Ok, I could not find any extensions that do this for prestashop 1.6, so ended up building the functionality myself. Please backup any files before attempting to making any changes detailed in this post. My needs: the functionality to create a separate registration page for a wholesale account. In processing the registration, the account is initially inactive and a notification email is sent to the admin to prompt him/her to approve. Here is the full code: wholesale_registration.zip Edit: Above link does not seem to work anymore, here is dropbox link: https://www.dropbox.com/s/hu6nc5yy91mupd7/wholesale_registration.zip?dl=0 1. Added the override file: /override/controllers/front/AuthController.php THIS IS NOT THE FULL CODE SO DO NOT COPY AND PASTE <?php class AuthController extends AuthControllerCore { public $wholesale_customer_group = 4; // // // more code here // // public function processSubmitAccountWholesale() { $this->processSubmitAccountWholesaleCreateAccount(); if(empty($this->errors)) { $customer = $this->context->customer; // add customer to wholesale group $customer->cleanGroups(); // delete all customer groups $customer->addGroups(array((int)$this->wholesale_customer_group)); // disable customer, needs approval if($customer->active==1) $customer->toggleStatus(); // send email to admin for approval Mail::Send( $this->context->language->id, 'wholesale_registration', Mail::l('Wholesale Registration'), array( '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{passwd}' => Tools::getValue('passwd')), Configuration::get('PS_SHOP_EMAIL'), Configuration::get('PS_SHOP_NAME') ); // now log the customer out $customer->logout(); // // finishing touches from processSubmitAccount() // if (!$customer->is_guest) if (!$this->sendConfirmationMail($customer)) $this->errors[] = Tools::displayError('The email cannot be sent.'); if ($this->ajax) { $return = array( 'hasError' => !empty($this->errors), 'errors' => $this->errors, 'isSaved' => true, 'id_customer' => (int)$this->context->cookie->id_customer, 'id_address_delivery' => $this->context->cart->id_address_delivery, 'id_address_invoice' => $this->context->cart->id_address_invoice, 'token' => Tools::getToken(false) ); die(Tools::jsonEncode($return)); } Tools::redirect('index.php?controller=authentication&layout=wholesale_confirm'); } } // // // more code here // // } If you need to edit this file, the above are most likely what you need to edit. $wholesale_customer_group is the id of the wholesale customer group. Function processSubmitAccountWholesale adds the customer to the wholesale group, inactivates the account, logs out the user, and sends the notification email to the admin. One other note, if you are are adding this file for the first time, you will need to delete or rename the file /cache/class_index.php for the override to take effect. 2. Add the registration template file /themes/[YOUR_THEME]/authentication_wholesale.tpl This file is just a copy of /themes/[YOUR_THEME]/authentication.tpl, with 2 changes First I changed: <form action="{$link->getPageLink('authentication', true)|escape:'html':'UTF-8'}" method="post" id="account-creation_form" class="std box"> to this <form action="{$link->getPageLink('authentication', true, NULL, 'layout=wholesale')|escape:'html':'UTF-8'}" method="post" id="account-creation_form" class="std box"> And changed this <button type="submit" name="submitAccount" id="submitAccount" class="btn btn-default button button-medium"> to this: <button type="submit" name="SubmitAccountWholesale" id="SubmitAccountWholesale" class="btn btn-default button button-medium"> 3. Add the registration confirmation template /themes/[YOUR_THEME]/authentication_wholesale_confirm.php This is just the confirmation page that is shown after registering on the wholesale confirmation account 4. Add the mail templates /themes/[YOUR_THEME]/mails/[iSO]/wholesale_registration.html /themes/[YOUR_THEME]/mails/[iSO]/wholesale_registration.txt This is the email notification sent to the admin That is it. If everything is done correctly, you will be able to access the separate registration page here: [YOUR_WEBSITE_ADDRESS]/index.php?controller=authentication&layout=wholesale Here is the full code: wholesale_registration.zip Edit: Above link does not seem to work anymore, here is dropbox link: https://www.dropbox.com/s/hu6nc5yy91mupd7/wholesale_registration.zip?dl=0 seyi thank you, your solution works like a charm in Presta 1.6.1.6 Link to comment Share on other sites More sharing options...
Bukhuu Posted August 22, 2016 Share Posted August 22, 2016 Hello masters, I just solve it which is more simple and easy. just copy and duplicate authentication.tpl file in your /themes/[yourtheme]/authentication.tpl. edit: AuthController.php Change this line: $this->setTemplate(_PS_THEME_DIR_.'authentication.tpl'); To: if(Tools::getValue('secondlayout')){ $this->setTemplate(_PS_THEME_DIR_.'authentication2.tpl'); }else{ $this->setTemplate(_PS_THEME_DIR_.'authentication.tpl'); } thats all. your url will be /web.site/authentication?secondlayout=true Hope this tip help to someone. Cheers Link to comment Share on other sites More sharing options...
wodzienka Posted September 19, 2016 Share Posted September 19, 2016 seyi thank you, your solution works like a charm in Presta 1.6.1.6 Dears, any idea why this code (working in 1.6.1.6) stopped to send wholesale_registration.html email after upgrading to 1.6.1.7??? Link to comment Share on other sites More sharing options...
seyi Posted September 20, 2016 Share Posted September 20, 2016 Not using that version so cant be sure. Looking at the code though, it should work. Verify the wholesale email template is in the right location. Link to comment Share on other sites More sharing options...
wodzienka Posted September 27, 2016 Share Posted September 27, 2016 Not using that version so cant be sure. Looking at the code though, it should work. Verify the wholesale email template is in the right location. Thank you, I found a problem's source elsewhere. During the upgrade, all overrides had been disabled by default. I had to enable them to make the code work again. So I can confirm now - seyi's code works in presta 1.6.1.7 as well! Once again - thank you for coding this, it saved my life Link to comment Share on other sites More sharing options...
varen Posted October 13, 2016 Share Posted October 13, 2016 Hello masters, I just solve it which is more simple and easy. just copy and duplicate authentication.tpl file in your /themes/[yourtheme]/authentication.tpl. edit: AuthController.php Change this line: $this->setTemplate(_PS_THEME_DIR_.'authentication.tpl'); To: if(Tools::getValue('secondlayout')){ $this->setTemplate(_PS_THEME_DIR_.'authentication2.tpl'); }else{ $this->setTemplate(_PS_THEME_DIR_.'authentication.tpl'); } thats all. your url will be /web.site/authentication?secondlayout=true Hope this tip help to someone. Cheers Hello masters, I just solve it which is more simple and easy. just copy and duplicate authentication.tpl file in your /themes/[yourtheme]/authentication.tpl. edit: AuthController.php Change this line: $this->setTemplate(_PS_THEME_DIR_.'authentication.tpl'); To: if(Tools::getValue('secondlayout')){ $this->setTemplate(_PS_THEME_DIR_.'authentication2.tpl'); }else{ $this->setTemplate(_PS_THEME_DIR_.'authentication.tpl'); } thats all. your url will be /web.site/authentication?secondlayout=true Hope this tip help to someone. Cheers did not work, prestashop 1.6.0.9 Link to comment Share on other sites More sharing options...
varen Posted October 13, 2016 Share Posted October 13, 2016 Hi, This not work in v.1.6.1.1 ? Have tried it and the result is the following: -Admin Receives no mail about registration - Wholesale customer is registered in the standard customer group (ID1) and are automatically logged on customer backoffice. From what I understand of these modified codes, the following happen: - Customer group "wholesale" should be created (group ID4) - When a wholesale customer signs up, this customer will automatically be added to wholesale group ID4, but inactive to admin has approved this customer. Admin will receive an email about this. Have I misunderstood something here? I have the same problem, it did not work, prestashop 1.6.0.9. Link to comment Share on other sites More sharing options...
tantouser Posted November 22, 2016 Share Posted November 22, 2016 Hi!!First of all thank for solution, is great and works perfect!!!IIT IS Absolute perfect, only I would have a doubt: is there any way to make the url friendly???I mean, instead of this: [YOUR_WEBSITE_ADDRESS]/index.php?controller=authentication&layout=wholesale Link to comment Share on other sites More sharing options...
seyi Posted November 22, 2016 Share Posted November 22, 2016 Hello, If you are using an seo extension, you could probably add the custom url and set the seo url yourself. Or another option is to add it to your htaccess file. Link to comment Share on other sites More sharing options...
tantouser Posted November 25, 2016 Share Posted November 25, 2016 I was thinking of creating a specific controller for it -make a frenndly url- instead of use htaccess, what solution is more correct? anyone knows it? Link to comment Share on other sites More sharing options...
seyi Posted November 26, 2016 Share Posted November 26, 2016 The more correct solution would be to make a new controller as the solution I created just piggy backed off the customer controller since most of the code would be the same. But in the end, it is really just preference, as long as the outcome is what you want. 1 Link to comment Share on other sites More sharing options...
tantouser Posted November 27, 2016 Share Posted November 27, 2016 Perfect Seyi, people like you helps a lot!! Thanks so much!! I am very thankfull for your time, this solution has save me a lot of time and energy. I am try to improve your module added a confirmation mail to send to the clients (wholeshales) that has been aproved from the back end, because, I only lack this functionality to have a "whole privated category" only for the customers that are in this group. I have find modules that make it, but it converts all my clients in unactivated, and I only want this group unactive by default, and I want to send their an automatic mail when their accounts(only the accounts in this group) were activated by admin. I have find anyway a solution that used with your module, make that people that are register with your module registration template go directly to my prefer group depends on the fields in the register (for example in my case they has to be more than 100 points of sales) which is a field that I added manually to your register form. Is called customer auto groups, it is here. https://github.com/nenes25/prestashop_customerautogroups I shared because some people can find it usefull. My prestashop version is 1.6.1.7 and it works perfect with your module. I only have to achieve to send a mail to my clients registered in the group 4 (wholesale) when I active their accounts, then they will can access to a private category of my shop. In the other hand, not related to this, I am working on a module too for the map (contact store) stores section.It will do a filter by any categories that I have created in the back end section. But is a hard and long way so, when I had finished, I will share here in the forums. Sorry for my bad english :-)) Thanks comunity for all your time!!! Link to comment Share on other sites More sharing options...
Recommended Posts