$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/home'),
'separator' => false
);
$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('text_account'),
'href' => $this->url->link('account/account', '', 'SSL'),
'separator' => $this->language->get('text_separator')
);
$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('account/address', '', 'SSL'),
'separator' => $this->language->get('text_separator')
);
$this->data['heading_title'] = $this->language->get('heading_title');
$this->data['text_address_book'] = $this->language->get('text_address_book');
$this->data['button_new_address'] = $this->language->get('button_new_address');
$this->data['button_edit'] = $this->language->get('button_edit');
$this->data['button_delete'] = $this->language->get('button_delete');
$this->data['button_back'] = $this->language->get('button_back');
if (isset($this->error['warning'])) {
$this->data['error_warning'] = $this->error['warning'];
} else {
$this->data['error_warning'] = '';
}
if (isset($this->session->data['success'])) {
$this->data['success'] = $this->session->data['success'];
unset($this->session->data['success']);
} else {
$this->data['success'] = '';
}
$this->data['addresses'] = array();
$results = $this->model_account_address->getAddresses();
foreach ($results as $result) {
if ($result['address_format']) {
$format = $result['address_format'];
} else {
$format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}';
}
$find = array(
'{firstname}',
'{lastname}',
'{company}',
'{address_1}',
'{address_2}',
'{city}',
'{postcode}',
'{zone}',
'{zone_code}',
'{country}'
);
$replace = array(
'firstname' => $result['firstname'],
'lastname' => $result['lastname'],
'company' => $result['company'],
'address_1' => $result['address_1'],
'address_2' => $result['address_2'],
'city' => $result['city'],
'postcode' => $result['postcode'],
'zone' => $result['zone'],
'zone_code' => $result['zone_code'],
'country' => $result['country']
);
$this->data['addresses'][] = array(
'address_id' => $result['address_id'],
'address' => str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\s\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format)))),
'update' => $this->url->link('account/address/update', 'address_id=' . $result['address_id'], 'SSL'),
'delete' => $this->url->link('account/address/delete', 'address_id=' . $result['address_id'], 'SSL')
);
}
$this->data['insert'] = $this->url->link('account/address/insert', '', 'SSL');
$this->data['back'] = $this->url->link('account/account', '', 'SSL');
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/account/address_list.tpl')) {
$this->template = $this->config->get('config_template') . '/template/account/address_list.tpl';
} else {
$this->template = 'default/template/account/address_list.tpl';
}
$this->children = array(
'common/column_left',
'common/column_right',
'common/content_top',
'common/content_bottom',
'common/footer',
'common/header'
);
$this->response->setOutput($this->render());