fsm Posted April 7, 2016 Share Posted April 7, 2016 (edited) Hello, I am making a online shop to my job. In this shop we are going to sell products to particular customer and companies so I changed 'Mr' and 'Miss' to 'Particular' and 'Company' respectively. The problem is that i want some required files for particular, like birthday's date, but not required for Company. Does anyone know how to do that? Is there some module i can use for it? Thank you. Edited April 7, 2016 by fsm (see edit history) Link to comment Share on other sites More sharing options...
shokinro Posted April 8, 2016 Share Posted April 8, 2016 You can implement server side custom validation inside following function of /controllers/front/AutthController.php Check if user choose "particular", then validate birthday, it is not entered, return validation error. protected function processSubmitAccount() { Hook::exec('actionBeforeSubmitAccount'); $this->create_account = true; if (Tools::isSubmit('submitAccount')) { $this->context->smarty->assign('email_create', 1); } // New Guest customer if (!Tools::getValue('is_new_customer', 1) && !Configuration::get('PS_GUEST_CHECKOUT_ENABLED')) { $this->errors[] = Tools::displayError('You cannot create a guest account.'); } if (!Tools::getValue('is_new_customer', 1)) { $_POST['passwd'] = md5(time()._COOKIE_KEY_); } ........ Note - Please consider to create override class and override the method instead of modifying original core files. Link to comment Share on other sites More sharing options...
fsm Posted April 8, 2016 Author Share Posted April 8, 2016 Thank you, but this is not exactly what i want. I want that the form ask to user birthday date if he choose "particular" but does not if he choose "company". Link to comment Share on other sites More sharing options...
shokinro Posted April 8, 2016 Share Posted April 8, 2016 I want that the form ask to user birthday date if he choose "particular" but does not if he choose "company". You can add your code there and modify original code? Link to comment Share on other sites More sharing options...
fsm Posted April 8, 2016 Author Share Posted April 8, 2016 Yes, I can modify the original code. Link to comment Share on other sites More sharing options...
shokinro Posted April 8, 2016 Share Posted April 8, 2016 so you can remove original logic code that you do not want. and add logic code that you want if "particular" is selected and birthrate is not entered { return error } note, this is not executable code, you have to change it, it is just for reference. 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