Jump to content

Required files of customer depending of gender


fsm

Recommended Posts

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 by fsm (see edit history)
Link to comment
Share on other sites

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...