Page 1 of 1

[MOD] Let customer delete the account

Posted: Tue Nov 09, 2010 3:55 am
by martynas.barzda
Customer can delete the account with this modification.
Image
Image

1. EDIT: catalog/model/account/customer.php
Add this function into ModelAccountCustomer class.

Code: Select all

public function deleteCustomer($customer_id) {
		$this->db->query("DELETE FROM " . DB_PREFIX . "customer WHERE customer_id = '" . (int)$customer_id . "'");
		$this->db->query("DELETE FROM " . DB_PREFIX . "address WHERE customer_id = '" . (int)$customer_id . "'");
	}
catalog/language/english/account/account.php

Code: Select all

$_['text_delete']        = 'Delete account';
catalog/view/theme/default/template/account/account.tpl

Code: Select all

<li><a href="<?php echo str_replace('&', '&', $delete); ?>"><?php echo $text_delete; ?></a></li>
2. UPLOAD: extract attached archive into "catalog" directory.

Re: [MOD] Let customer delete the account

Posted: Mon Nov 15, 2010 11:37 pm
by cricri92
I installed your module but I get an error when I click on "delete account" in the browser

Code: Select all

You don't have permission to acces /opencart/<b>Notice</b>Undefined variable: delete in
<b>C:/wamp/www/opencart/boutique/catalog/view/theme/default/template/account/account.tpl</b> on line <b>19</b> on this server.
thank you

Re: [MOD] Let customer delete the account

Posted: Tue Nov 16, 2010 2:02 am
by SapporoGuy
What is on line 19 (17-20) in the account.tpl ?

Also, possibly you might have to add:

Code: Select all

$this->data['text_delete'] = $this->language->get('text_delete');
to the controller/account file

Bad Idea [MOD] Let customer delete the account

Posted: Tue Nov 16, 2010 2:53 am
by Gilmore
While I do appreciate your making an Extension and I can understand you think the Customer needs this option, they actually don't. You can't go to Sears and delete your account. They do this for a reason. Down the road you have a problem with the very same Customer, you have no records to back up your side of anything. Actually it's pretty unheard of to allow Customers to delete their account. This is not a Forum or Bulletin Board. I would not let a Customer delete their records in my business once I have done business with them. Businesses just don't let the Customers delete their accounts on their own for a reason. What if someone steals this persons login and deletes them while they are waiting on an order? Then they contact you and ask the status of their order? You look it up and can't find a thing because someone deleted their account. What are you going to do then?

And what if they Delete their account after running up a huge order and you ship it only to find out a few days later they were all about the fraud of ripping you off? Now you go to look them up and NO RECORDS!!!! Well so much for having their IP to help the Authorities out! See my point?

DO NOT LET PEOPLE DELETE YOUR CUSTOMER ACCOUNTS!!!
Their records are you proof of what they do. Erase that and it is ALL on you! And try to get a Court to side with you when you are getting sued for not being able to prove they did that form your web site!

I hope next you don't think letting the Customers alter their order once it has been placed will be a good idea too! lol

JMO!

Gilmore

Re: [MOD] Let customer delete the account

Posted: Tue Nov 16, 2010 4:12 am
by Xsecrets
while I don't really see the need for this mod either it would not delete all your records the orders would still be there along with the ip information associated. All that would get deleted is the customer record which is pretty much just their address book, which you will have that information in the order anyways. Like I said I don't really see the need for this mod, but I don't see it being as bad as you are making it out to be. The worst case scenario is like you said someone gets a customers details and deletes their account, however the order would still be there and get processed. That customer would just loose their saved addresses cart and the ability to look at their order history.

Re: [MOD] Let customer delete the account

Posted: Thu Dec 22, 2011 4:39 pm
by rbelusa
a short one from my side. in germany this MOD is absolutely mandatory and also not to store the IP Adress, because in germany you are not allowed to run an ecommerce shop without these 2 functionality (plus some other points). You will get highly sued, before you open your store because of dataprivacy, datasecurity, law. thanks for this Mod/Help.

Re: [MOD] Let customer delete the account

Posted: Sun Jan 08, 2012 6:21 pm
by Vytenis
Thanks for the mod, it really looks useful. Did anyone tried it with 1.5.1.x?

Re: [MOD] Let customer delete the account

Posted: Mon Apr 30, 2018 9:49 pm
by robster
Did this mod ever get developed to be used in later versions of opencart such as 1.5.x 2.0 or later? I think it is a great idea, particularly with the upcoming GDPR data protection laws.

Re: [MOD] Let customer delete the account

Posted: Tue May 01, 2018 5:40 pm
by OSWorX
robster wrote:
Mon Apr 30, 2018 9:49 pm
Did this mod ever get developed to be used in later versions of opencart such as 1.5.x 2.0 or later? I think it is a great idea, particularly with the upcoming GDPR data protection laws.
Does no matter if this lines got updated for later versions or not

The GDPR has one rule (beside many others): customer shall be able to remove his account (deleting data associated with his person) at any time.

> The right to be forgotten <

This can be done automatically (via a form by the customer) or manually (by shopowner after request) after approval.

EXCEPT: personal data required for bookkeeping is not allowed to delete (depends on locale laws between 7 and 10 [ore more] years).
Otherwise you get in trouble with your financial department.

What can be done: except the sales data all other records can be anonymized.
And an existing newsletter subscription of this customer (which has to have a Double Optin solution at registration btw.) can be deleted - or if stored with IP > anonymized.

One exception from this rule exist: if a (criminal) court decision exists not to delete this data (e.g. in case of fraud or other criminal activity).

Re: [MOD] Let customer delete the account

Posted: Wed May 02, 2018 10:59 pm
by straightlight
An update I have received today from Axelos / EXIN providers about the implementation of the GDPR restrictions in the ITIL Best Practices starting in the upcoming May 25.

Re: [MOD] Let customer delete the account

Posted: Sat May 26, 2018 2:18 am
by ivan111
Is this a good PHP code for 1.5.6. I'm constantly getting a mistake. I get a white screen.

<?php
class ControllerAccountDelete extends Controller {
private $error = array();

public function index() {
if (!$this->customer->isLogged()) {
$this->session->data['redirect'] = HTTPS_SERVER . 'index.php?route=account/delete';

$this->redirect(HTTPS_SERVER . 'index.php?route=account/login');
}

$this->language->load('account/delete');

$this->document->title = $this->language->get('heading_title');

if (isset($this->request->post['password']) && $this->validate()) {
$this->load->model('account/customer');

$this->model_account_customer->deleteCustomer($this->customer->getId());

$this->redirect(HTTPS_SERVER);
}

$this->document->breadcrumbs = array();

$this->document->breadcrumbs[] = array(
'href' => HTTP_SERVER . 'index.php?route=common/home',
'text' => $this->language->get('text_home'),
'separator' => FALSE
);

$this->document->breadcrumbs[] = array(
'href' => HTTPS_SERVER . 'index.php?route=account/account',
'text' => $this->language->get('text_account'),
'separator' => $this->language->get('text_separator')
);

$this->document->breadcrumbs[] = array(
'href' => HTTPS_SERVER . 'index.php?route=account/delete',
'text' => $this->language->get('heading_title'),
'separator' => $this->language->get('text_separator')
);

$this->data['heading_title'] = $this->language->get('heading_title');

$this->data['text_password'] = $this->language->get('text_password');

$this->data['entry_password'] = $this->language->get('entry_password');

$this->data['button_continue'] = $this->language->get('button_continue');
$this->data['button_back'] = $this->language->get('button_back');

if (isset($this->error['confirm'])) {
$this->data['error_confirm'] = $this->error['confirm'];
} else {
$this->data['error_confirm'] = '';
}

$this->data['action'] = HTTPS_SERVER . 'index.php?route=account/delete';

if (isset($this->request->post['password'])) {
$this->data['password'] = $this->request->post['password'];
} else {
$this->data['password'] = '';
}

$this->data['back'] = HTTPS_SERVER . 'index.php?route=account/account';

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/account/delete.tpl')) {
$this->template = $this->config->get('config_template') . '/template/account/delete.tpl';
} else {
$this->template = 'default/template/account/delete.tpl';
}

$this->children = array(
'common/column_right',
'common/footer',
'common/column_left',
'common/header'
);

$this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
}

private function validate() {
if (!$this->customer->login($this->customer->getEmail(), $this->request->post['password'])) {
$this->error['confirm'] = $this->language->get('error_confirm');
}

if (!$this->error) {
return TRUE;
} else {
return FALSE;
}
}
}
?>

Re: [MOD] Let customer delete the account

Posted: Sun May 27, 2018 1:11 am
by IP_CAM
Well, after investing the equivalent of a few hundred Bucks in time :laugh: , looking for
1.5.6.4+ routines, possibly replacing some of the existing code, it now seems to work.
And without errors, as it looks, at least in a fully default 1.5.6.5_rc Version and Theme.
I will try it in one of my latest Testshops, and then decide, if it makes sense, to have it
built-in by default in my future work.
---
And to this:

Code: Select all

DO NOT LET PEOPLE DELETE YOUR CUSTOMER ACCOUNTS!!!
Their records are you proof of what they do. Erase that and it is ALL on you!
It does not matter, if an account is deleted, the full Proof of Sale Records still exists,
with Customer Invoice(s), Names and Addresses, in the Administration Section.
---
It would have been easy to do, for a Pro at least, but most don't care any longer about older
Versions, or then, they don't bother anymore, to assist others for free, to then even get called
names, like asshole, as it happen to me some hours ago, by some mannerless ignorant, unwilling
to read, or just unable to understand, on how to 'technically behave' around here first, to enable
someone, to reply in the first place.
---
It made me think about again, if it's worth it, to further share free knowledge here, and I am very
unsure, if and what answer I will find.
Ernie
---
( Code used from here at the OC Forum )
Delete Account for OC v.1.5.x - by use oc v.1.5.6.x Default Theme:
Image
---
( Bootstrap3-modified Mod, but Publisher + Links do not exist anymore )
Account Cancellation for OC v.1.5.x with Bootstrap-3 v.1.5.6.5_rc Theme:
Image