Almost worked, wrong parameter passed to address->delete().
Also added another message - testing Hikashop with other components which output their own "user has been deleted messages", so looks better having a Hikashop message as well.
$result = parent::delete($el);
if($result){
$address = hikashop::get('class.address');
$addresses = $address->loadUserAddresses($el);
foreach ($addresses as $a) {
$address->delete($a->address_id);
}
$app =& JFactory::getApplication();
$app->enqueueMessage('User deleted from Hikashop.');
}
Would it be possible to add a configuration option so that when selected deleting a customer via the customer screen will also delete the Joomla user? Need to be careful here that someone does not accidently delete an administrator / super administrator account - I think there was another post about prevent certain users being Hikashop customers - I have been registering test users but someone else went in as themselves (administrator) and tested order creation - something I would like to see prevented.