Jump to content

action before customer account delete


TechZiqy

Recommended Posts

Hello,

i would like to have an alert on the back-office before to delete a customer account if his last order is not delivered yet, and i use the hookActionObjectCustomerDeleteBefore hook but it dosn"t work ; i see the hook in my logs but i don't see the alert and the customer is deleted.

is someone know how to do this ?
Thanks,

my code (presta 1.6.1.9) :

    public function hookActionObjectCustomerDeleteBefore($params) { // before to delete customer account
        /*
            'cust object'
        */
        $o_cust = $params['object'];
        PrestaShopLogger::addLog('hookActionObjectCustomerDeleteBefore - id_cust : '.$o_cust->id, 1, null, null, null, true);
        if (gdprcomplianceBusiness::f_isSubActiveByCust($o_cust->id)) {
            PrestaShopLogger::addLog('hookActionObjectCustomerDeleteBefore - the customer '.$o_cust->id. ' always  has an active subscription', 1, null, null, null, true);
            $this->context->controller->errors[] = Tools::displayError('This customer always has subscriptions to cancel before delete');
            return false;
        }
        else {
            return true;
        }

 

 

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...