$json = array();
if (isset($this->request->get['customer_id'])) {
$customer_id = $this->request->get['customer_id'];
} else {
$customer_id = 0;
}
$this->load->model('sale/customer');
$customer_info = $this->model_sale_customer->getCustomer($customer_id);
if ($customer_info) {
$token = md5(mt_rand());
$this->model_sale_customer->editToken($customer_id, $token);
if (isset($this->request->get['store_id'])) {
$store_id = $this->request->get['store_id'];
} else {
$store_id = 0;
}
$this->load->model('setting/store');
$store_info = $this->model_setting_store->getStore($store_id);
if ($store_info) {
$this->redirect($store_info['url'] . 'index.php?route=account/login&token=' . $token);
} else {
$this->redirect(HTTP_CATALOG . 'index.php?route=account/login&token=' . $token);
}
} else {
$this->language->load('error/not_found');
$this->document->setTitle($this->language->get('heading_title'));
$this->data['heading_title'] = $this->language->get('heading_title');
$this->data['text_not_found'] = $this->language->get('text_not_found');
$this->data['breadcrumbs'] = array();
$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
'separator' => false
);
$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('error/not_found', 'token=' . $this->session->data['token'], 'SSL'),
'separator' => ' :: '
);
$this->template = 'error/not_found.tpl';
$this->children = array(
'common/header',
'common/footer'
);
$this->response->setOutput($this->render());
}