Search code examples
prestashopprestashop-1.6

Prestashop - additional code when deleting a customer


I would like to add the code associated with one of the modules that should be executed when the client is removed by the administrator in the back office. Where should I put this code? I cant find the right file.

Code should be executed after clicking the 'Delete' button

Update

I added this code to the module for testing, but it doesn't seem to do anything.

public function hookActionObjectCustomerDeleteAfter($params)
{
    $customer_id = (int)$params['object']->id;
    PrestaShopLogger::addLog( 
        sprintf('Customer with id %d was deleted with success', $customer_id)
    ); 
}

Solution

  • I guess the right hook would be hookActionObjectCustomerDeleteAfter in some custom module. Don't forget to register your module to the hook before launching the code. You can do this during a module install process in install method with code $this->registerHook('actionObjectCustomerDeleteAfter')