TechZiqy Posted April 17, 2019 Share Posted April 17, 2019 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 More sharing options...
joseantgv Posted April 17, 2019 Share Posted April 17, 2019 I think the only way is to to set a die instead of return false;. Link to comment Share on other sites More sharing options...
TechZiqy Posted April 18, 2019 Author Share Posted April 18, 2019 yes, it works, but not very friendly for the merchant 😉 you don't have any other idea ? Link to comment Share on other sites More sharing options...
Rodrigo B Laurindo Posted April 23, 2019 Share Posted April 23, 2019 I think you would have to override the class customer. Or maybe using jquery to intercept the delete button click. 1 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