function deleteaddress($req)
{
// NOTE: we don't want to fully delete the address because it's presumably still
// attached to an order. Setting MemberID to 0 means it won't show up in the address
// book any longer.
$address = $this->member->AddressBook()->byID($req->param('ID'));
if ($address) {
$address->MemberID = 0;
$address->write();
} else {
$this->httpError(404, 'Address not found');
}
return $this->redirectBack();
}